summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-10-18 14:06:11 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-10-18 14:41:13 +0200
commit2f406e540379bed70a809c78bf37ec3ccf5f4b4c (patch)
tree80f458ce5c398f9ef0aae4d82b093cbe34d40d38 /apps/files_sharing/tests
parent8e3f21d9ed74d2ec33a2093a2a577b34d1503c47 (diff)
downloadnextcloud-server-2f406e540379bed70a809c78bf37ec3ccf5f4b4c.tar.gz
nextcloud-server-2f406e540379bed70a809c78bf37ec3ccf5f4b4c.zip
More fixes
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php26
1 files changed, 18 insertions, 8 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index dc0231b1973..6f053eef124 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -1667,7 +1667,7 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ [$userFolder, $path] = $this->getNonSharedUserFile();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
@@ -1695,7 +1695,7 @@ class ShareAPIControllerTest extends TestCase {
$share = $this->newShare();
$this->shareManager->method('newShare')->willReturn($share);
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ [$userFolder, $path] = $this->getNonSharedUserFile();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
@@ -1741,7 +1741,7 @@ class ShareAPIControllerTest extends TestCase {
])->setMethods(['formatShare'])
->getMock();
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ [$userFolder, $path] = $this->getNonSharedUserFile();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
@@ -1791,7 +1791,7 @@ class ShareAPIControllerTest extends TestCase {
$this->shareManager->method('createShare')->willReturnArgument(0);
$this->shareManager->method('allowGroupSharing')->willReturn(true);
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ [$userFolder, $path] = $this->getNonSharedUserFile();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
@@ -2244,7 +2244,7 @@ class ShareAPIControllerTest extends TestCase {
])->setMethods(['formatShare'])
->getMock();
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ [$userFolder, $path] = $this->getNonSharedUserFile();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
@@ -2310,7 +2310,7 @@ class ShareAPIControllerTest extends TestCase {
])->setMethods(['formatShare'])
->getMock();
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ [$userFolder, $path] = $this->getNonSharedUserFile();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
@@ -2549,19 +2549,29 @@ class ShareAPIControllerTest extends TestCase {
])->setMethods(['formatShare'])
->getMock();
- [$userFolder, $path] = $this->getNonSharedUserFolder();
+ $userFolder = $this->getMockBuilder(Folder::class)->getMock();
$this->rootFolder->expects($this->exactly(2))
->method('getUserFolder')
->with('currentUser')
->willReturn($userFolder);
+ $path = $this->getMockBuilder(Folder::class)->getMock();
+ $storage = $this->createMock(Storage::class);
+ $storage->method('instanceOfStorage')
+ ->willReturnMap([
+ ['OCA\Files_Sharing\External\Storage', true],
+ ['OCA\Files_Sharing\SharedStorage', false],
+ ]);
+ $userFolder->method('getStorage')->willReturn($storage);
+ $path->method('getStorage')->willReturn($storage);
+
$path->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
$userFolder->expects($this->once())
->method('get')
->with('valid-path')
->willReturn($path);
$userFolder->method('getById')
- ->willReturn([$path]);
+ ->willReturn([]);
$this->userManager->method('userExists')->with('validUser')->willReturn(true);