summaryrefslogtreecommitdiffstats
path: root/tests/lib/Share20
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-04-10 16:53:58 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-04-13 12:58:52 +0200
commit4eeb194ae5f7d52e40a2be318730f0c44eb19ca8 (patch)
tree926d845a225ad4cb3d3970a52d4c9c26234d4f94 /tests/lib/Share20
parent5b57bb955b6f5289bf80aac7ade760d76ce033c6 (diff)
downloadnextcloud-server-4eeb194ae5f7d52e40a2be318730f0c44eb19ca8.tar.gz
nextcloud-server-4eeb194ae5f7d52e40a2be318730f0c44eb19ca8.zip
Fix share manager test
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Share20')
-rw-r--r--tests/lib/Share20/ManagerTest.php37
1 files changed, 24 insertions, 13 deletions
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index c1a0eaf5bb8..42308a9d6a6 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -1022,12 +1022,12 @@ class ManagerTest extends \Test\TestCase {
public function testUserCreateChecksIdenticalPathSharedViaDeletedGroup() {
$share = $this->manager->newShare();
- $sharedWith = $this->getMock('\OCP\IUser');
+ $sharedWith = $this->createMock(IUser::class);
$sharedWith->method('getUID')->willReturn('sharedWith');
$this->userManager->method('get')->with('sharedWith')->willReturn($sharedWith);
- $path = $this->getMock('\OCP\Files\Node');
+ $path = $this->createMock(Node::class);
$share->setSharedWith('sharedWith')
->setNode($path)
@@ -1136,7 +1136,7 @@ class ManagerTest extends \Test\TestCase {
public function testGroupCreateChecksShareWithGroupMembersOnlyNullGroup() {
$share = $this->manager->newShare();
- $user = $this->getMock('\OCP\IUser');
+ $user = $this->createMock(IUser::class);
$share->setSharedBy('user')->setSharedWith('group');
$this->groupManager->method('get')->with('group')->willReturn(null);
@@ -2611,7 +2611,7 @@ class ManagerTest extends \Test\TestCase {
$share->setShareType(\OCP\Share::SHARE_TYPE_GROUP);
$share->setSharedWith('shareWith');
- $recipient = $this->getMock('\OCP\IUser');
+ $recipient = $this->createMock(IUser::class);
$this->groupManager->method('get')->with('shareWith')->willReturn(null);
$this->userManager->method('get')->with('recipient')->willReturn($recipient);
@@ -2779,6 +2779,8 @@ class ManagerTest extends \Test\TestCase {
->willReturn($folder);
$file->method('getPath')
->willReturn('/owner/files/folder/file');
+ $file->method('getId')
+ ->willReturn(23);
$folder->method('getParent')
->willReturn($userFolder);
$folder->method('getPath')
@@ -2800,9 +2802,9 @@ class ManagerTest extends \Test\TestCase {
)
->willReturn([
'users' => [
- 'user1',
- 'user2',
- 'user3',
+ 'user1' => [],
+ 'user2' => [],
+ 'user3' => [],
],
'public' => true,
]);
@@ -2814,11 +2816,13 @@ class ManagerTest extends \Test\TestCase {
)
->willReturn([
'users' => [
- 'user3',
- 'user4',
- 'user5',
+ 'user3' => [],
+ 'user4' => [],
+ 'user5' => [],
+ ],
+ 'remote' => [
+ 'remote1',
],
- 'remote' => true,
]);
$this->rootFolder->method('getUserFolder')
@@ -2826,9 +2830,16 @@ class ManagerTest extends \Test\TestCase {
->willReturn($userFolder);
$expected = [
- 'users' => ['owner', 'user1', 'user2', 'user3', 'user4', 'user5'],
+ 'users' => [
+ 'owner' => [
+ 'node_id' => 23,
+ 'node_path' => '/folder/file'
+ ]
+ , 'user1' => [], 'user2' => [], 'user3' => [], 'user4' => [], 'user5' => []],
+ 'remote' => [
+ 'remote1',
+ ],
'public' => true,
- 'remote' => true,
];
$result = $manager->getAccessList($node, true, true);