summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests/External
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-07-13 17:51:52 +0200
committerVincent Petry <vincent@nextcloud.com>2021-07-27 12:19:26 +0200
commite8f4a524a2ae917c62710dd635df2740081bc83f (patch)
treea9f5a8492f0750cd15a9d63035ee0e3a93a6104e /apps/files_sharing/tests/External
parent15f41a6b727ba437536fc727778cc41ca710d0d5 (diff)
downloadnextcloud-server-e8f4a524a2ae917c62710dd635df2740081bc83f.tar.gz
nextcloud-server-e8f4a524a2ae917c62710dd635df2740081bc83f.zip
Fix external share manager with multiple user groups
Use query builder with proper matching for finding the group names. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/tests/External')
-rw-r--r--apps/files_sharing/tests/External/ManagerTest.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php
index 6dc9ced87a7..39e25dd75a6 100644
--- a/apps/files_sharing/tests/External/ManagerTest.php
+++ b/apps/files_sharing/tests/External/ManagerTest.php
@@ -144,9 +144,17 @@ class ManagerTest extends TestCase {
$group1->expects($this->any())->method('getGID')->willReturn('group1');
$group1->expects($this->any())->method('inGroup')->with($this->user)->willReturn(true);
+ $group2 = $this->createMock(IGroup::class);
+ $group2->expects($this->any())->method('getGID')->willReturn('group2');
+ $group2->expects($this->any())->method('inGroup')->with($this->user)->willReturn(true);
+
$this->userManager->expects($this->any())->method('get')->willReturn($this->user);
- $this->groupManager->expects($this->any())->method(('getUserGroups'))->willReturn([$group1]);
- $this->groupManager->expects($this->any())->method(('get'))->with('group1')->willReturn($group1);
+ $this->groupManager->expects($this->any())->method(('getUserGroups'))->willReturn([$group1, $group2]);
+ $this->groupManager->expects($this->any())->method(('get'))
+ ->will($this->returnValueMap([
+ ['group1', $group1],
+ ['group2', $group2],
+ ]));
}
protected function tearDown(): void {