summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2016-06-18 22:04:56 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-31 15:55:40 +0100
commit3692769b0a0713fa9e3976692736da76707986c5 (patch)
tree7749b3fcc18a8027301635519794a44b9bdc683e /apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
parent357a823457397d3e93ec8cd4dc01fb6859eb0049 (diff)
downloadnextcloud-server-3692769b0a0713fa9e3976692736da76707986c5.tar.gz
nextcloud-server-3692769b0a0713fa9e3976692736da76707986c5.zip
Add getShareTypesInFolder to optimize folder listening
Signed-off-by: Robin Appelman <icewind@owncloud.com>
Diffstat (limited to 'apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php')
-rw-r--r--apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
index 433ef4ba63a..2e17c7d0b38 100644
--- a/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
@@ -206,6 +206,14 @@ class SharesPluginTest extends \Test\TestCase {
->method('get')
->with('/subdir')
->will($this->returnValue($node));
+
+ $dummyShares = array_map(function($type) {
+ $share = $this->getMock('\OCP\Share\IShare');
+ $share->expects($this->any())
+ ->method('getShareType')
+ ->will($this->returnValue($type));
+ return $share;
+ }, $shareTypes);
$this->shareManager->expects($this->any())
->method('getSharesBy')
@@ -224,6 +232,17 @@ class SharesPluginTest extends \Test\TestCase {
return [];
}));
+ $this->shareManager->expects($this->any())
+ ->method('getSharesInFolder')
+ ->with(
+ $this->equalTo('user1'),
+ $this->anything(),
+ $this->equalTo(false)
+ )
+ ->will($this->returnCallback(function ($userId, $node, $flag) use ($shareTypes, $dummyShares) {
+ return [111 => $dummyShares];
+ }));
+
// simulate sabre recursive PROPFIND traversal
$propFindRoot = new \Sabre\DAV\PropFind(
'/subdir',