From 3692769b0a0713fa9e3976692736da76707986c5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 18 Jun 2016 22:04:56 +0200 Subject: Add getShareTypesInFolder to optimize folder listening Signed-off-by: Robin Appelman --- .../tests/unit/Connector/Sabre/SharesPluginTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php') 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', -- cgit v1.2.3