summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBjoern Schiessle <bjoern@schiessle.org>2016-10-24 17:03:36 +0200
committerBjoern Schiessle <bjoern@schiessle.org>2016-11-01 19:54:39 +0100
commit318160647a62386b4fda5c04ddca04673bf97813 (patch)
tree4682a016d1e9e10e827e5fcb1d7781b0066c49b0 /tests
parent96c40d14a1a253974db8cb2a51f227afe5dff7bf (diff)
downloadnextcloud-server-318160647a62386b4fda5c04ddca04673bf97813.tar.gz
nextcloud-server-318160647a62386b4fda5c04ddca04673bf97813.zip
add method to check if a share provider for a given type is loaded
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Share20/ManagerTest.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index c0c7b48b35d..bd85e3c73aa 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -2530,6 +2530,46 @@ class ManagerTest extends \Test\TestCase {
$this->manager->moveShare($share, 'recipient');
}
+
+ /**
+ * @dataProvider dataTestShareProviderExists
+ */
+ public function testShareProviderExists($shareType, $expected) {
+
+ $factory = $this->getMockBuilder('OCP\Share\IProviderFactory')->getMock();
+ $factory->expects($this->any())->method('getProviderForType')
+ ->willReturnCallback(function ($id) {
+ if ($id === \OCP\Share::SHARE_TYPE_USER) {
+ return true;
+ }
+ throw new Exception\ProviderException();
+ });
+
+ $manager = new Manager(
+ $this->logger,
+ $this->config,
+ $this->secureRandom,
+ $this->hasher,
+ $this->mountManager,
+ $this->groupManager,
+ $this->l,
+ $factory,
+ $this->userManager,
+ $this->rootFolder,
+ $this->eventDispatcher
+ );
+ $this->assertSame($expected,
+ $manager->shareProviderExists($shareType)
+ );
+ }
+
+ public function dataTestShareProviderExists() {
+ return [
+ [\OCP\Share::SHARE_TYPE_USER, true],
+ [42, false],
+ ];
+ }
+
public function testGetSharesInFolder() {
$factory = new DummyFactory2($this->createMock(IServerContainer::class));