|
|
|
@ -1,18 +1,18 @@ |
|
|
|
<?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 |
|
|
|
* later. |
|
|
|
* See the COPYING-README file. |
|
|
|
*/ |
|
|
|
|
|
|
|
use OCA\Files\Share; |
|
|
|
use OCA\Files\Share\Tests; |
|
|
|
use OCA\Files_sharing\Tests\TestCase; |
|
|
|
|
|
|
|
/** |
|
|
|
* 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 |
|
|
|
@ -48,19 +48,18 @@ class Test_Files_Sharing_Capabilities extends \PHPUnit_Framework_TestCase { |
|
|
|
/** |
|
|
|
* @covers OCA\Files_Sharing\Capabilities::getCaps |
|
|
|
*/ |
|
|
|
public function testCapabilities() { |
|
|
|
/* |
|
|
|
* Test for no link sharing |
|
|
|
*/ |
|
|
|
public function test_no_link_sharing() { |
|
|
|
$map = array( |
|
|
|
array('core', 'shareapi_allow_links', 'yes', 'no') |
|
|
|
); |
|
|
|
$result = $this->getResults($map); |
|
|
|
$this->assertEmpty($result); |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
|
* Test only link sharing |
|
|
|
*/ |
|
|
|
/** |
|
|
|
* @covers OCA\Files_Sharing\Capabilities::getCaps |
|
|
|
*/ |
|
|
|
public function test_only_link_sharing() { |
|
|
|
$map = array( |
|
|
|
array('core', 'shareapi_allow_links', 'yes', 'yes'), |
|
|
|
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)); |
|
|
|
$this->assertCount(1, $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( |
|
|
|
array('core', 'shareapi_allow_links', '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->assertArrayHasKey('allow_links', $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( |
|
|
|
array('core', 'shareapi_allow_links', 'yes', 'yes'), |
|
|
|
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->assertArrayHasKey('allow_links', $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 |
|
|
|
*/ |
|
|
|
|