diff options
author | Björn Schießle <schiessle@owncloud.com> | 2016-04-18 18:17:08 +0200 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2016-04-22 14:55:40 +0200 |
commit | e10105474fbef8940fdfa96d5e2bf2f09b1f0649 (patch) | |
tree | 1881e059a3408a2d4e8096e31719ba989f7dfab1 /apps/federatedfilesharing/tests | |
parent | 606b756a94643eaae87e18b39f6c75e6d18fec7e (diff) | |
download | nextcloud-server-e10105474fbef8940fdfa96d5e2bf2f09b1f0649.tar.gz nextcloud-server-e10105474fbef8940fdfa96d5e2bf2f09b1f0649.zip |
move federated sharing settings to the federatedfilesharing app
Diffstat (limited to 'apps/federatedfilesharing/tests')
-rw-r--r-- | apps/federatedfilesharing/tests/federatedshareprovidertest.php | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/apps/federatedfilesharing/tests/federatedshareprovidertest.php b/apps/federatedfilesharing/tests/federatedshareprovidertest.php index 92e9f10c3cd..1fbae90a46f 100644 --- a/apps/federatedfilesharing/tests/federatedshareprovidertest.php +++ b/apps/federatedfilesharing/tests/federatedshareprovidertest.php @@ -26,6 +26,7 @@ use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Notifications; use OCA\FederatedFileSharing\TokenHandler; use OCP\Files\IRootFolder; +use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; @@ -54,6 +55,8 @@ class FederatedShareProviderTest extends TestCase { protected $logger; /** @var IRootFolder | \PHPUnit_Framework_MockObject_MockObject */ protected $rootFolder; + /** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */ + protected $config; /** @var IManager */ protected $shareManager; @@ -78,6 +81,7 @@ class FederatedShareProviderTest extends TestCase { })); $this->logger = $this->getMock('OCP\ILogger'); $this->rootFolder = $this->getMock('OCP\Files\IRootFolder'); + $this->config = $this->getMock('OCP\IConfig'); $this->addressHandler = new AddressHandler(\OC::$server->getURLGenerator(), $this->l); $this->provider = new FederatedShareProvider( @@ -87,7 +91,8 @@ class FederatedShareProviderTest extends TestCase { $this->tokenHandler, $this->l, $this->logger, - $this->rootFolder + $this->rootFolder, + $this->config ); $this->shareManager = \OC::$server->getShareManager(); @@ -510,4 +515,43 @@ class FederatedShareProviderTest extends TestCase { $this->assertCount($rowDeleted ? 0 : 1, $data); } + + /** + * @dataProvider dataTestFederatedSharingSettings + * + * @param string $isEnabled + * @param bool $expected + */ + public function testIsOutgoingServer2serverShareEnabled($isEnabled, $expected) { + $this->config->expects($this->once())->method('getAppValue') + ->with('files_sharing', 'outgoing_server2server_share_enabled', 'yes') + ->willReturn($isEnabled); + + $this->assertSame($expected, + $this->provider->isOutgoingServer2serverShareEnabled() + ); + } + + /** + * @dataProvider dataTestFederatedSharingSettings + * + * @param string $isEnabled + * @param bool $expected + */ + public function testIsIncomingServer2serverShareEnabled($isEnabled, $expected) { + $this->config->expects($this->once())->method('getAppValue') + ->with('files_sharing', 'incoming_server2server_share_enabled', 'yes') + ->willReturn($isEnabled); + + $this->assertSame($expected, + $this->provider->isIncomingServer2serverShareEnabled() + ); + } + + public function dataTestFederatedSharingSettings() { + return [ + ['yes', true], + ['no', false] + ]; + } } |