summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2019-02-19 10:28:28 +0100
committerGitHub <noreply@github.com>2019-02-19 10:28:28 +0100
commit30e7d3e0e8e0c19119e8fcc29c9349f6909e630c (patch)
treea029c54fe70239284241c1e9137e87745d9d6f2b /tests
parentef4e7d010e74b8ce9efdf71dbc23fc4cadc7b69e (diff)
parentf66c37bdb8fe3ed84737554e1e9bbb8d33722496 (diff)
downloadnextcloud-server-30e7d3e0e8e0c19119e8fcc29c9349f6909e630c.tar.gz
nextcloud-server-30e7d3e0e8e0c19119e8fcc29c9349f6909e630c.zip
Merge pull request #14194 from nextcloud/bugfix/noid/correctly-determinate-owner-in-case-of-shared-external-storages
Correctly determinate the owner in case of shared external storages
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Share20/ManagerTest.php46
1 files changed, 30 insertions, 16 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 80747e1a157..ddbfe857222 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -3427,15 +3427,15 @@ class ManagerTest extends \Test\TestCase {
$extraProvider = $this->createMock(IShareProvider::class);
$factory->setSecondProvider($extraProvider);
- $owner = $this->createMock(IUser::class);
- $owner->expects($this->once())
+ $nodeOwner = $this->createMock(IUser::class);
+ $nodeOwner->expects($this->once())
->method('getUID')
- ->willReturn('owner');
+ ->willReturn('user1');
$node = $this->createMock(Node::class);
$node->expects($this->once())
->method('getOwner')
- ->willReturn($owner);
+ ->willReturn($nodeOwner);
$node->method('getId')
->willReturn(42);
@@ -3443,10 +3443,17 @@ class ManagerTest extends \Test\TestCase {
$file = $this->createMock(File::class);
$folder = $this->createMock(Folder::class);
+ $owner = $this->createMock(IUser::class);
+ $owner->expects($this->once())
+ ->method('getUID')
+ ->willReturn('owner');
+
$file->method('getParent')
->willReturn($folder);
$file->method('getPath')
->willReturn('/owner/files/folder/file');
+ $file->method('getOwner')
+ ->willReturn($owner);
$file->method('getId')
->willReturn(23);
$folder->method('getParent')
@@ -3455,12 +3462,12 @@ class ManagerTest extends \Test\TestCase {
->willReturn('/owner/files/folder');
$userFolder->method('getById')
->with($this->equalTo(42))
- ->willReturn([$file]);
+ ->willReturn([12 => $file]);
$userFolder->method('getPath')
- ->willReturn('/owner/files');
+ ->willReturn('/user1/files');
$this->userManager->method('userExists')
- ->with($this->equalTo('owner'))
+ ->with($this->equalTo('user1'))
->willReturn(true);
$this->defaultProvider->method('getAccessList')
@@ -3494,7 +3501,7 @@ class ManagerTest extends \Test\TestCase {
]);
$this->rootFolder->method('getUserFolder')
- ->with($this->equalTo('owner'))
+ ->with($this->equalTo('user1'))
->willReturn($userFolder);
$expected = [
@@ -3536,26 +3543,33 @@ class ManagerTest extends \Test\TestCase {
$extraProvider = $this->createMock(IShareProvider::class);
$factory->setSecondProvider($extraProvider);
- $owner = $this->createMock(IUser::class);
- $owner->expects($this->once())
+ $nodeOwner = $this->createMock(IUser::class);
+ $nodeOwner->expects($this->once())
->method('getUID')
- ->willReturn('owner');
+ ->willReturn('user1');
$node = $this->createMock(Node::class);
$node->expects($this->once())
->method('getOwner')
- ->willReturn($owner);
+ ->willReturn($nodeOwner);
$node->method('getId')
->willReturn(42);
$userFolder = $this->createMock(Folder::class);
$file = $this->createMock(File::class);
+
+ $owner = $this->createMock(IUser::class);
+ $owner->expects($this->once())
+ ->method('getUID')
+ ->willReturn('owner');
$folder = $this->createMock(Folder::class);
$file->method('getParent')
->willReturn($folder);
$file->method('getPath')
->willReturn('/owner/files/folder/file');
+ $file->method('getOwner')
+ ->willReturn($owner);
$file->method('getId')
->willReturn(23);
$folder->method('getParent')
@@ -3564,12 +3578,12 @@ class ManagerTest extends \Test\TestCase {
->willReturn('/owner/files/folder');
$userFolder->method('getById')
->with($this->equalTo(42))
- ->willReturn([$file]);
+ ->willReturn([42 => $file]);
$userFolder->method('getPath')
- ->willReturn('/owner/files');
+ ->willReturn('/user1/files');
$this->userManager->method('userExists')
- ->with($this->equalTo('owner'))
+ ->with($this->equalTo('user1'))
->willReturn(true);
$this->defaultProvider->method('getAccessList')
@@ -3605,7 +3619,7 @@ class ManagerTest extends \Test\TestCase {
]);
$this->rootFolder->method('getUserFolder')
- ->with($this->equalTo('owner'))
+ ->with($this->equalTo('user1'))
->willReturn($userFolder);
$expected = [