summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2018-08-09 10:44:11 +0200
committerGitHub <noreply@github.com>2018-08-09 10:44:11 +0200
commit6aa6d2186cbc7c5a5db0cf8e1a20c82896266321 (patch)
tree03d8cf8c3fbf6ba9296a8394b4b18d79b2870300 /tests
parentca0f2f63eb19f0d92d83c1ebbd1a29d2c7c45e08 (diff)
parent4b7fa4ac2e2562025672a389567ee659adff01ab (diff)
downloadnextcloud-server-6aa6d2186cbc7c5a5db0cf8e1a20c82896266321.tar.gz
nextcloud-server-6aa6d2186cbc7c5a5db0cf8e1a20c82896266321.zip
Merge pull request #10255 from nextcloud/add-support-for-room-shares
Add support for room shares
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Share20/ManagerTest.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 7106e22b264..1125cae9565 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -2165,6 +2165,56 @@ class ManagerTest extends \Test\TestCase {
$this->assertSame($share, $ret);
}
+ public function testGetShareByTokenRoom() {
+ $this->config
+ ->expects($this->once())
+ ->method('getAppValue')
+ ->with('core', 'shareapi_allow_links', 'yes')
+ ->willReturn('no');
+
+ $factory = $this->createMock(IProviderFactory::class);
+
+ $manager = new Manager(
+ $this->logger,
+ $this->config,
+ $this->secureRandom,
+ $this->hasher,
+ $this->mountManager,
+ $this->groupManager,
+ $this->l,
+ $this->l10nFactory,
+ $factory,
+ $this->userManager,
+ $this->rootFolder,
+ $this->eventDispatcher,
+ $this->mailer,
+ $this->urlGenerator,
+ $this->defaults
+ );
+
+ $share = $this->createMock(IShare::class);
+
+ $roomShareProvider = $this->createMock(IShareProvider::class);
+
+ $factory->expects($this->any())
+ ->method('getProviderForType')
+ ->will($this->returnCallback(function($shareType) use ($roomShareProvider) {
+ if ($shareType !== \OCP\Share::SHARE_TYPE_ROOM) {
+ throw new Exception\ProviderException();
+ }
+
+ return $roomShareProvider;
+ }));
+
+ $roomShareProvider->expects($this->once())
+ ->method('getShareByToken')
+ ->with('token')
+ ->willReturn($share);
+
+ $ret = $manager->getShareByToken('token');
+ $this->assertSame($share, $ret);
+ }
+
public function testGetShareByTokenWithException() {
$this->config
->expects($this->once())