Split up unit tests

This commit is contained in:
Roeland Jago Douma 2015-02-04 15:49:20 +01:00
parent 083ebca812
commit bcae79a85a

View file

@ -1,18 +1,18 @@
<?php <?php
/** /**
* Copyright (c) Roeland Jago Douma <roeland@famdouma.nl> * Copyright (c) 2015 Roeland Jago Douma <roeland@famdouma.nl>
* This file is licensed under the Affero General Public License version 3 or * This file is licensed under the Affero General Public License version 3 or
* later. * later.
* See the COPYING-README file. * See the COPYING-README file.
*/ */
use OCA\Files\Share; use OCA\Files\Share\Tests;
use OCA\Files_sharing\Tests\TestCase; use OCA\Files_sharing\Tests\TestCase;
/** /**
* Class Test_Files_Sharing_Capabilties * Class Test_Files_Sharing_Capabilties
*/ */
class Test_Files_Sharing_Capabilities extends \PHPUnit_Framework_TestCase { class Test_Files_Sharing_Capabilities extends \Test\TestCase {
/** /**
* Test for the general part in each return statement and assert * Test for the general part in each return statement and assert
@ -48,19 +48,18 @@ class Test_Files_Sharing_Capabilities extends \PHPUnit_Framework_TestCase {
/** /**
* @covers OCA\Files_Sharing\Capabilities::getCaps * @covers OCA\Files_Sharing\Capabilities::getCaps
*/ */
public function testCapabilities() { public function test_no_link_sharing() {
/*
* Test for no link sharing
*/
$map = array( $map = array(
array('core', 'shareapi_allow_links', 'yes', 'no') array('core', 'shareapi_allow_links', 'yes', 'no')
); );
$result = $this->getResults($map); $result = $this->getResults($map);
$this->assertEmpty($result); $this->assertEmpty($result);
}
/* /**
* Test only link sharing * @covers OCA\Files_Sharing\Capabilities::getCaps
*/ */
public function test_only_link_sharing() {
$map = array( $map = array(
array('core', 'shareapi_allow_links', 'yes', 'yes'), array('core', 'shareapi_allow_links', 'yes', 'yes'),
array('core', 'shareapi_enforce_links_password', 'yes', 'no'), array('core', 'shareapi_enforce_links_password', 'yes', 'no'),
@ -69,10 +68,12 @@ class Test_Files_Sharing_Capabilities extends \PHPUnit_Framework_TestCase {
$result = $this->getSharing($this->getResults($map)); $result = $this->getSharing($this->getResults($map));
$this->assertCount(1, $result); $this->assertCount(1, $result);
$this->assertArrayHasKey('allow_links', $result); $this->assertArrayHasKey('allow_links', $result);
}
/* /**
* Test link sharing with enforced passwords * @covers OCA\Files_Sharing\Capabilities::getCaps
*/ */
public function test_link_sharing_password() {
$map = array( $map = array(
array('core', 'shareapi_allow_links', 'yes', 'yes'), array('core', 'shareapi_allow_links', 'yes', 'yes'),
array('core', 'shareapi_enforce_links_password', 'yes', 'yes'), array('core', 'shareapi_enforce_links_password', 'yes', 'yes'),
@ -82,10 +83,12 @@ class Test_Files_Sharing_Capabilities extends \PHPUnit_Framework_TestCase {
$this->assertCount(2, $result); $this->assertCount(2, $result);
$this->assertArrayHasKey('allow_links', $result); $this->assertArrayHasKey('allow_links', $result);
$this->assertArrayHasKey('enforce_links_password', $result); $this->assertArrayHasKey('enforce_links_password', $result);
}
/* /**
* Test link sharing with public upload * @covers OCA\Files_Sharing\Capabilities::getCaps
*/ */
public function test_link_sharing_public_uploads() {
$map = array( $map = array(
array('core', 'shareapi_allow_links', 'yes', 'yes'), array('core', 'shareapi_allow_links', 'yes', 'yes'),
array('core', 'shareapi_enforce_links_password', 'yes', 'no'), array('core', 'shareapi_enforce_links_password', 'yes', 'no'),
@ -95,7 +98,12 @@ class Test_Files_Sharing_Capabilities extends \PHPUnit_Framework_TestCase {
$this->assertCount(2, $result); $this->assertCount(2, $result);
$this->assertArrayHasKey('allow_links', $result); $this->assertArrayHasKey('allow_links', $result);
$this->assertArrayHasKey('allow_public_upload', $result); $this->assertArrayHasKey('allow_public_upload', $result);
}
/**
* @covers OCA\Files_Sharing\Capabilities::getCaps
*/
public function test_link_sharing_all() {
/* /*
* Test link sharing with all options on * Test link sharing with all options on
*/ */