From e8f4a524a2ae917c62710dd635df2740081bc83f Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Tue, 13 Jul 2021 17:51:52 +0200 Subject: Fix external share manager with multiple user groups Use query builder with proper matching for finding the group names. Signed-off-by: Vincent Petry --- apps/files_sharing/tests/External/ManagerTest.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'apps/files_sharing/tests/External') 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 { -- cgit v1.2.3