Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/AutoGroupsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function addAndRemoveAutoGroups($event)

// Get user information
$user = $event->getUser();
$userGroupNames = array_keys($this->groupManager->getUserGroups($user));
$userGroupNames = $this->groupManager->getUserGroupIds($user);

// Notice message for Auto Group Hook Execution
$this->logger->debug('AutoGroups hook triggered for user ' . $user->getDisplayName());
Expand Down
14 changes: 7 additions & 7 deletions tests/Unit/AutoGroupsManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testAddingToAutoGroups()

// User belongs to no groups, so they should be added to the auto group
$this->groupManager->expects($this->once())
->method('getUserGroups')
->method('getUserGroupIds')
->with($this->testUser)
->willReturn([]);

Expand All @@ -141,9 +141,9 @@ public function testAddingNotRequired()

// User is already in the auto group, so addUser should never be called
$this->groupManager->expects($this->once())
->method('getUserGroups')
->method('getUserGroupIds')
->with($this->testUser)
->willReturn(['autogroup' => []]);
->willReturn(['autogroup']);

$autogroup = $this->createMock(IGroup::class);
$autogroup->expects($this->once())->method('getGID')->willReturn('autogroup');
Expand All @@ -168,9 +168,9 @@ public function testRemoveUserFromAutoGroups()

// User belongs to an override group, so they should be removed from all auto groups
$this->groupManager->expects($this->once())
->method('getUserGroups')
->method('getUserGroupIds')
->with($this->testUser)
->willReturn(['autogroup1' => [], 'overridegroup1' => [], 'autogroup2' => []]);
->willReturn(['autogroup1', 'overridegroup1', 'autogroup2']);

$groupMock = $this->createMock(IGroup::class);
$groupMock->expects($this->exactly(2))->method('getGID')->willReturnOnConsecutiveCalls('autogroup1', 'autogroup2');
Expand All @@ -195,9 +195,9 @@ public function testRemoveNotRequired()

// User is in an override group but not in any auto group, so removeUser should never be called
$this->groupManager->expects($this->once())
->method('getUserGroups')
->method('getUserGroupIds')
->with($this->testUser)
->willReturn(['overridegroup1' => []]);
->willReturn(['overridegroup1']);

$groupMock = $this->createMock(IGroup::class);
$groupMock->expects($this->exactly(2))->method('getGID')->willReturnOnConsecutiveCalls('autogroup1', 'autogroup2');
Expand Down
Loading