From da07e6515e8bdc109379502b8cc82a97d4f4d8e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= <14975046+skjnldsv@users.noreply.github.com> Date: Thu, 26 Nov 2026 22:08:15 +0100 Subject: [PATCH] fix(employees): treat disabled accounts as people who left MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A disabled account still counted as an employee everywhere: people who left showed up in Insights ("Most vacation still to take"), in the reports, in coverage, in the pickers and the team calendar, got reminders and new-year vacation days, and their row on the Employees page asked for missing data. They stay employees for their records: HR still sees them on the Employees page, marked and with a filter, can correct their leave, finds them in the picker and exports their requests. Everything about the people working here now asks the directory for the active employees instead, which leaves the disabled accounts out. They are read once per request with getDisabledUsers(), not account by account. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com> --- SPECIFICATION.md | 12 +++ lib/Controller/EmployeeController.php | 5 +- lib/Service/CalendarService.php | 2 +- lib/Service/CarryOverReminderService.php | 2 +- lib/Service/CoverageService.php | 4 +- lib/Service/EmployeeDirectory.php | 80 ++++++++++++++++++ lib/Service/EmployeeListService.php | 8 +- lib/Service/EntitlementService.php | 10 +-- lib/Service/InsightsService.php | 2 +- lib/Service/RegionReminderService.php | 2 +- lib/Service/ReportService.php | 4 +- src/types/employees.ts | 2 + src/views/hr/HrEmployees.vue | 18 +++- tests/Integration/DisabledAccountsTest.php | 83 +++++++++++++++++++ .../Controller/EmployeeControllerTest.php | 5 ++ tests/Unit/Service/CalendarServiceTest.php | 2 +- .../Service/CarryOverReminderServiceTest.php | 2 +- tests/Unit/Service/InsightsServiceTest.php | 2 +- 18 files changed, 223 insertions(+), 22 deletions(-) create mode 100644 tests/Integration/DisabledAccountsTest.php diff --git a/SPECIFICATION.md b/SPECIFICATION.md index 3d2c5702..376dd43f 100644 --- a/SPECIFICATION.md +++ b/SPECIFICATION.md @@ -173,6 +173,18 @@ calendar forever, with an empty allowance and nothing to show. deleted later, the app **fails open** (every non-guest account counts again) and logs an error — failing closed would silently freeze leave booking for the whole company. +- **Disabled accounts are people who left.** They stay employees for their records: + HR still sees them on the Employees page (marked *Account disabled*, with a + filter), can open, correct and record their leave, finds them in the people + picker, and exports them with the requests. Nothing about the people working here + now counts them: they are left out of Insights and every report (balances + included), coverage, the team calendar, the pickers of everyone but HR, the + region and carry-over reminders, a change of the default vacation days, the bulk + entitlement edit and the year rollover. Their row never shows missing data. + `EmployeeDirectory::listActive()` and friends read the disabled accounts once per + request (`IUserManager::getDisabledUsers()`), not account by account. Retention + still counts from the contract end date only, so disabling an account by mistake + starts no deletion. Enabling the account again brings the person back everywhere. --- diff --git a/lib/Controller/EmployeeController.php b/lib/Controller/EmployeeController.php index aa5cdd54..ad8536f1 100644 --- a/lib/Controller/EmployeeController.php +++ b/lib/Controller/EmployeeController.php @@ -151,6 +151,9 @@ public function search(string $search = '', int $limit = 20): DataResponse { $results['users'] ?? [], ); + // HR may still record or correct the leave of somebody who left; for + // everyone else a disabled account is nobody to pick. + $isHr = $this->permission->isHr((string)$this->userId); $employees = []; // First, because somebody typing their own name has matched it exactly and // should not be pushed below looser matches on it. @@ -164,7 +167,7 @@ public function search(string $search = '', int $limit = 20): DataResponse { if ($uid === '' || isset($employees[$uid])) { continue; } - if (!$this->employees->isEmployee($uid)) { + if (!($isHr ? $this->employees->isEmployee($uid) : $this->employees->isActive($uid))) { continue; } $employees[$uid] = [ diff --git a/lib/Service/CalendarService.php b/lib/Service/CalendarService.php index 64f0738d..1b33b720 100644 --- a/lib/Service/CalendarService.php +++ b/lib/Service/CalendarService.php @@ -105,7 +105,7 @@ public function teamEvents(string $uid): array { } $year = $this->clock->serverYear(); $requests = $this->requestMapper->findInForceBetween(($year - 1) . '-01-01', ($year + 1) . '-12-31'); - $names = $this->employees->displayNames(); + $names = $this->employees->activeDisplayNames(); $l = $this->personalL10n($uid); $reveal = $this->config->getSharedCalendarVisibility() === ConfigService::VISIBILITY_REVEAL; $events = []; diff --git a/lib/Service/CarryOverReminderService.php b/lib/Service/CarryOverReminderService.php index 62bfe871..8f6b775d 100644 --- a/lib/Service/CarryOverReminderService.php +++ b/lib/Service/CarryOverReminderService.php @@ -66,7 +66,7 @@ public function remind(): int { // Confidential types (§5.7) are not on the employee's own balance either. $hrOnlyIds = $this->leaveTypeMapper->hrOnlyTypeIds(); $reminded = 0; - foreach ($this->balanceService->getBalancesForEmployees($this->employees->listAll(), $year) as $uid => $rows) { + foreach ($this->balanceService->getBalancesForEmployees($this->employees->listActive(), $year) as $uid => $rows) { $days = 0.0; foreach ($rows as $row) { if (!in_array($row['typeId'], $hrOnlyIds, true)) { diff --git a/lib/Service/CoverageService.php b/lib/Service/CoverageService.php index dd061c57..4ff281a8 100644 --- a/lib/Service/CoverageService.php +++ b/lib/Service/CoverageService.php @@ -55,7 +55,7 @@ public function resolveScopeUids(string $actorUid, string $scope, bool $withOwnM return []; } if ($scope === self::SCOPE_COMPANY && $this->permission->isHr($actorUid)) { - return $this->employees->listAll(); + return $this->employees->listActive(); } // Team scope: the actor's reports if they manage, otherwise their peers + self. $reports = $this->managerResolver->getDirectReports($actorUid); @@ -243,7 +243,7 @@ private function teammateUids(string $uid): array { ...($managerUid !== null ? [$managerUid] : []), ...$this->managerResolver->getDirectReports($uid), ]); - return $this->employees->filter(array_values(array_filter($uids, static fn (string $other): bool => $other !== $uid))); + return $this->employees->filterActive(array_values(array_filter($uids, static fn (string $other): bool => $other !== $uid))); } /** diff --git a/lib/Service/EmployeeDirectory.php b/lib/Service/EmployeeDirectory.php index d231f90f..410fdb9b 100644 --- a/lib/Service/EmployeeDirectory.php +++ b/lib/Service/EmployeeDirectory.php @@ -36,6 +36,12 @@ * it also bounds what {@see listAll()} has to enumerate: reading one group * beats walking the whole user backend on a large LDAP instance. * + * A **disabled account** is still an employee here: HR keeps the records of + * people who left, can correct them and exports them. Everything about the + * people who work here now (reports, coverage, pickers, the team calendar, + * reminders and the rollover) asks for the *active* employees instead + * ({@see listActive()}, {@see isActive()}), which leave disabled accounts out. + * * A guest is a user in the Guests app's own user backend, which is what * `OCA\Guests\GuestManager::isGuest()` checks too. Reading the backend name * keeps this app free of a hard dependency on the Guests app: with the app @@ -53,6 +59,8 @@ class EmployeeDirectory { private array $guestCache = []; /** Employees-group id resolved once per request; null = not resolved yet. */ private ?string $employeesGroup = null; + /** @var array|null uid => disabled, read once per request */ + private ?array $disabled = null; public function __construct( private IUserManager $userManager, @@ -193,6 +201,78 @@ public function isGuest(string $uid): bool { return $user !== null && $this->isGuestUser($user); } + /** + * Every employee whose account is enabled: the people who work here now. + * + * @return string[] + */ + public function listActive(): array { + return $this->withoutDisabled($this->listAll()); + } + + /** + * {@see listInGroup()}, without the disabled accounts. + * + * @return string[] + */ + public function listActiveInGroup(?string $group): array { + return $this->withoutDisabled($this->listInGroup($group)); + } + + /** + * {@see displayNames()}, without the disabled accounts. + * + * @return array + */ + public function activeDisplayNames(): array { + return array_diff_key($this->displayNames(), $this->disabledUids()); + } + + /** Whether this uid is an employee whose account is enabled. */ + public function isActive(string $uid): bool { + return $this->isEmployee($uid) && !isset($this->disabledUids()[$uid]); + } + + /** Whether this uid's account is disabled, false for an unknown uid. */ + public function isDisabled(string $uid): bool { + return isset($this->disabledUids()[$uid]); + } + + /** + * {@see filter()}, without the disabled accounts. + * + * @param string[] $uids + * @return string[] + */ + public function filterActive(array $uids): array { + return $this->withoutDisabled($this->filter($uids)); + } + + /** + * @param string[] $uids + * @return string[] + */ + private function withoutDisabled(array $uids): array { + $disabled = $this->disabledUids(); + return array_values(array_filter($uids, static fn (string $uid): bool => !isset($disabled[$uid]))); + } + + /** + * The disabled accounts, read in one call rather than account by account, + * which on LDAP would cost a lookup per person. + * + * @return array + */ + private function disabledUids(): array { + if ($this->disabled === null) { + $this->disabled = []; + foreach ($this->userManager->getDisabledUsers() as $user) { + $this->disabled[$user->getUID()] = true; + } + } + return $this->disabled; + } + /** * Filter a list of uids down to the employees in it, preserving order. * diff --git a/lib/Service/EmployeeListService.php b/lib/Service/EmployeeListService.php index 1686bcf8..fce3dd80 100644 --- a/lib/Service/EmployeeListService.php +++ b/lib/Service/EmployeeListService.php @@ -93,7 +93,10 @@ public function rows(array $uids, int $year): array { } } $current = self::currentPeriod($contract, $today); - $missing = array_keys(array_filter([ + // Somebody who left keeps their records here, but nothing is missing + // any more: their row never counts towards the data HR has to fill in. + $disabled = $this->directory->isDisabled($uid); + $missing = $disabled ? [] : array_keys(array_filter([ self::MISSING_REGION => $this->holidays->needsRegion($region), self::MISSING_CONTRACT => $contract['periods'] === [], self::MISSING_START => $contract['start'] === null, @@ -102,7 +105,8 @@ public function rows(array $uids, int $year): array { 'uid' => $uid, 'displayName' => $this->displayName($uid), 'regionCode' => $region, - 'regionIncomplete' => $region !== '' && $this->holidays->needsRegion($region), + 'regionIncomplete' => !$disabled && $region !== '' && $this->holidays->needsRegion($region), + 'disabled' => $disabled, 'contract' => $contract, 'current' => $current, 'manager' => $managerUid === null ? null : ['uid' => $managerUid, 'displayName' => $this->displayName($managerUid)], diff --git a/lib/Service/EntitlementService.php b/lib/Service/EntitlementService.php index 5ef63152..e744a03e 100644 --- a/lib/Service/EntitlementService.php +++ b/lib/Service/EntitlementService.php @@ -241,7 +241,7 @@ private function onDefault(float $days): array { if ($annualTypeId === null) { return []; } - $employees = array_fill_keys($this->employees->listAll(), true); + $employees = array_fill_keys($this->employees->listActive(), true); return array_values(array_filter( $this->entitlementMapper->findForYear($this->clock->serverYear()), static fn (Entitlement $ent): bool => $ent->getTypeId() === $annualTypeId @@ -364,7 +364,7 @@ public function rollover(int $fromYear): array { $annualTypeId = $this->annualTypeId(); if ($annualTypeId !== null) { $default = $this->config->getDefaultEntitlement(); - foreach ($this->employees->listAll() as $uid) { + foreach ($this->employees->listActive() as $uid) { $targets[$uid][$annualTypeId] ??= $default; } } @@ -380,8 +380,8 @@ public function rollover(int $fromYear): array { foreach ($targets as $uid => $perType) { $uid = (string)$uid; // No entitlement for a year outside the contract (§6.4), and no carry-over - // from one - if (!$this->balanceService->isEmployedIn($uid, $toYear)) { + // from one. Nor for somebody whose account is disabled: they left. + if (!$this->balanceService->isEmployedIn($uid, $toYear) || $this->employees->isDisabled($uid)) { continue; } $carriesOver = $this->balanceService->isEmployedIn($uid, $fromYear); @@ -642,6 +642,6 @@ private function assertCountingType(int $typeId): void { * @return string[] */ private function targetUids(?string $group): array { - return $this->employees->listInGroup($group); + return $this->employees->listActiveInGroup($group); } } diff --git a/lib/Service/InsightsService.php b/lib/Service/InsightsService.php index afa48ff5..fc190ff7 100644 --- a/lib/Service/InsightsService.php +++ b/lib/Service/InsightsService.php @@ -47,7 +47,7 @@ public function __construct( * @return array */ public function getInsights(int $year): array { - $uids = $this->employees->listInGroup(null); + $uids = $this->employees->listActiveInGroup(null); $uidSet = array_fill_keys($uids, true); $teams = $this->buildTeams($uids); $balances = $this->balanceService->getBalancesForEmployees($uids, $year); diff --git a/lib/Service/RegionReminderService.php b/lib/Service/RegionReminderService.php index cfdc4db8..655faba8 100644 --- a/lib/Service/RegionReminderService.php +++ b/lib/Service/RegionReminderService.php @@ -49,7 +49,7 @@ public function plan(): array { $since = $this->clock->now()->getTimestamp() - self::QUIET_SECONDS; $remindedAt = $this->userConfig->getValuesByUsers(ConfigService::APP_ID, ConfigLexicon::KEY_REGION_REMINDED_AT, ValueType::INT); $plan = ['send' => [], 'recent' => []]; - foreach ($this->employees->listAll() as $uid) { + foreach ($this->employees->listActive() as $uid) { $uid = (string)$uid; $code = $codes[$uid] ?? ''; if (!$this->holidays->needsRegion($code)) { diff --git a/lib/Service/ReportService.php b/lib/Service/ReportService.php index 855eb4cf..8bf53d57 100644 --- a/lib/Service/ReportService.php +++ b/lib/Service/ReportService.php @@ -67,7 +67,7 @@ public function balancesReport(int $year, ?string $group = null): array { * @return list> */ public function teamBalances(string $managerUid, int $year): array { - $uids = $this->employees->filter($this->managerResolver->getDirectReports($managerUid)); + $uids = $this->employees->filterActive($this->managerResolver->getDirectReports($managerUid)); $balances = $this->balanceService->getBalancesForEmployees($uids, $year); $report = []; foreach ($uids as $uid) { @@ -266,7 +266,7 @@ private function sickLeaveTypes(?int $typeId): array { * @return string[] */ private function employeeUids(?string $group): array { - return $this->employees->listInGroup($group); + return $this->employees->listActiveInGroup($group); } private function displayName(string $uid): string { diff --git a/src/types/employees.ts b/src/types/employees.ts index 98a90fb8..7d3c1c41 100644 --- a/src/types/employees.ts +++ b/src/types/employees.ts @@ -145,6 +145,8 @@ export interface EmployeeRow { regionCode: string /** A country-only code while that country has regional holidays in the list. */ regionIncomplete: boolean + /** The account is disabled: somebody who left, kept for the records */ + disabled: boolean contract: Contract /** The working pattern in force today, or the first one while none has started; null without any. */ current: ContractPeriod | null diff --git a/src/views/hr/HrEmployees.vue b/src/views/hr/HrEmployees.vue index 734c57bd..debd44e8 100644 --- a/src/views/hr/HrEmployees.vue +++ b/src/views/hr/HrEmployees.vue @@ -118,6 +118,11 @@ hideStatus /> {{ row.displayName }} + @@ -154,7 +159,7 @@ {{ formatDate(row.contract.start) }} @@ -283,7 +288,7 @@ import { formatNumber } from '../../utils/locale.ts' import { regionFlag } from '../../utils/regions.ts' import { formatWeekdays } from '../../utils/weekdays.ts' -type FilterId = 'all' | 'missing' | 'partTime' | 'startsOrLeaves' +type FilterId = 'all' | 'missing' | 'partTime' | 'startsOrLeaves' | 'disabled' /** A chip of the filter row */ interface FilterOption { @@ -305,6 +310,7 @@ const matches: Record boolean> = { missing: (row) => row.missing.length > 0, partTime: (row) => row.partTime, startsOrLeaves: (row) => row.startsOrLeaves, + disabled: (row) => row.disabled, } const currentYear = new Date().getFullYear() @@ -335,6 +341,7 @@ const filters = computed(() => { { id: 'missing', label: `⚠️ ${n('absence', 'Missing data {count}', 'Missing data {count}', count(matches.missing), { count: count(matches.missing) })}` }, { id: 'partTime', label: n('absence', 'Part-time {count}', 'Part-time {count}', count(matches.partTime), { count: count(matches.partTime) }) }, { id: 'startsOrLeaves', label: n('absence', 'Starts or leaves in {year} {count}', 'Starts or leaves in {year} {count}', count(matches.startsOrLeaves), { year: year.value, count: count(matches.startsOrLeaves) }) }, + ...(count(matches.disabled) > 0 ? [{ id: 'disabled' as const, label: n('absence', 'Account disabled {count}', 'Account disabled {count}', count(matches.disabled), { count: count(matches.disabled) }) }] : []), ] }) @@ -448,6 +455,11 @@ async function onSaved(): Promise { gap: 10px; } + &__left { + margin-inline-start: 8px; + vertical-align: middle; + } + &__none { color: var(--color-text-maxcontrast); } diff --git a/tests/Integration/DisabledAccountsTest.php b/tests/Integration/DisabledAccountsTest.php new file mode 100644 index 00000000..6c0a14e0 --- /dev/null +++ b/tests/Integration/DisabledAccountsTest.php @@ -0,0 +1,83 @@ +get($uid) ?? $users->createUser($uid, 'Itest-Password-disabled-1'))->setDisplayName('Itest ' . $uid); + } + $users->get(self::LEFT)->setEnabled(false); + } + + protected function tearDown(): void { + foreach ([self::ACTIVE, self::LEFT] as $uid) { + Server::get(IUserManager::class)->get($uid)?->delete(); + } + parent::tearDown(); + } + + public function testTheDirectoryKeepsThemAsEmployeesButNotAsActiveOnes(): void { + $directory = Server::get(EmployeeDirectory::class); + + self::assertTrue($directory->isEmployee(self::LEFT)); + self::assertContains(self::LEFT, $directory->listAll()); + self::assertArrayHasKey(self::LEFT, $directory->displayNames()); + + self::assertFalse($directory->isActive(self::LEFT)); + self::assertTrue($directory->isDisabled(self::LEFT)); + self::assertNotContains(self::LEFT, $directory->listActive()); + self::assertNotContains(self::LEFT, $directory->listActiveInGroup(null)); + self::assertArrayNotHasKey(self::LEFT, $directory->activeDisplayNames()); + self::assertSame([self::ACTIVE], $directory->filterActive([self::LEFT, self::ACTIVE])); + + self::assertTrue($directory->isActive(self::ACTIVE)); + self::assertContains(self::ACTIVE, $directory->listActive()); + } + + public function testHrStillSeesThemWithNothingMissing(): void { + $rows = Server::get(EmployeeListService::class)->rows([self::ACTIVE, self::LEFT], self::YEAR); + [$active, $left] = $rows; + + self::assertTrue($left['disabled']); + self::assertSame([], $left['missing']); + self::assertFalse($left['regionIncomplete']); + + self::assertFalse($active['disabled']); + self::assertNotSame([], $active['missing']); + } + + public function testReportsAndInsightsLeaveThemOut(): void { + $report = Server::get(ReportService::class)->balancesReport(self::YEAR); + self::assertNotContains(self::LEFT, array_column($report, 'employeeUid')); + self::assertContains(self::ACTIVE, array_column($report, 'employeeUid')); + + $insights = json_encode(Server::get(InsightsService::class)->getInsights(self::YEAR), JSON_THROW_ON_ERROR); + self::assertStringNotContainsString(self::LEFT, $insights); + } +} diff --git a/tests/Unit/Controller/EmployeeControllerTest.php b/tests/Unit/Controller/EmployeeControllerTest.php index 84505792..a77f8166 100644 --- a/tests/Unit/Controller/EmployeeControllerTest.php +++ b/tests/Unit/Controller/EmployeeControllerTest.php @@ -73,6 +73,7 @@ public function testSearchIncludesTheSigningInUserWhenTheyMatch(): void { $this->collaboratorSearchReturns([]); $this->selfIs('Frank Karlitschek'); $this->employees->method('isEmployee')->willReturn(true); + $this->employees->method('isActive')->willReturn(true); $data = $this->controller->search('frank')->getData(); @@ -83,6 +84,7 @@ public function testSearchMatchesTheSigningInUserByUid(): void { $this->collaboratorSearchReturns([]); $this->selfIs('Frank Karlitschek'); $this->employees->method('isEmployee')->willReturn(true); + $this->employees->method('isActive')->willReturn(true); self::assertSame('hr-user', $this->controller->search('hr-us')->getData()[0]['uid']); } @@ -93,6 +95,7 @@ public function testSearchLeavesTheSigningInUserOutWhenTheyDoNotMatch(): void { ]); $this->selfIs('Frank Karlitschek'); $this->employees->method('isEmployee')->willReturn(true); + $this->employees->method('isActive')->willReturn(true); $data = $this->controller->search('lea')->getData(); @@ -104,6 +107,7 @@ public function testSearchNeverOffersTheSigningInUserWhenTheyAreAGuest(): void { $this->selfIs('Guest Person'); // Guests hold no entitlement and take no leave, their own account included. $this->employees->method('isEmployee')->willReturn(false); + $this->employees->method('isActive')->willReturn(false); self::assertSame([], $this->controller->search('guest')->getData()); } @@ -115,6 +119,7 @@ public function testSearchDoesNotListTheSigningInUserTwice(): void { ]); $this->selfIs('Frank Karlitschek'); $this->employees->method('isEmployee')->willReturn(true); + $this->employees->method('isActive')->willReturn(true); self::assertCount(1, $this->controller->search('frank')->getData()); } diff --git a/tests/Unit/Service/CalendarServiceTest.php b/tests/Unit/Service/CalendarServiceTest.php index c434cdc0..2a156279 100644 --- a/tests/Unit/Service/CalendarServiceTest.php +++ b/tests/Unit/Service/CalendarServiceTest.php @@ -50,7 +50,7 @@ protected function setUp(): void { $this->permission = $this->createMock(PermissionService::class); $this->permission->method('isEmployeeOrHr')->willReturn(true); $this->employees = $this->createMock(EmployeeDirectory::class); - $this->employees->method('displayNames')->willReturn(['alice' => 'Alice Example', 'bob' => 'Bob Example', '90817' => 'Numeric Example']); + $this->employees->method('activeDisplayNames')->willReturn(['alice' => 'Alice Example', 'bob' => 'Bob Example', '90817' => 'Numeric Example']); $this->clock = $this->createMock(ClockService::class); $this->clock->method('serverYear')->willReturn(2026); $this->l10nFactory = $this->createMock(IFactory::class); diff --git a/tests/Unit/Service/CarryOverReminderServiceTest.php b/tests/Unit/Service/CarryOverReminderServiceTest.php index 9a661ac6..96482917 100644 --- a/tests/Unit/Service/CarryOverReminderServiceTest.php +++ b/tests/Unit/Service/CarryOverReminderServiceTest.php @@ -48,7 +48,7 @@ protected function setUp(): void { $this->balances->method('getBalancesForEmployees')->willReturnCallback(fn (): array => $this->rows); $employees = $this->createMock(EmployeeDirectory::class); - $employees->method('listAll')->willReturnCallback(fn (): array => array_keys($this->rows)); + $employees->method('listActive')->willReturnCallback(fn (): array => array_keys($this->rows)); $types = $this->createMock(LeaveTypeMapper::class); $types->method('hrOnlyTypeIds')->willReturn([9]); diff --git a/tests/Unit/Service/InsightsServiceTest.php b/tests/Unit/Service/InsightsServiceTest.php index 22845710..61139070 100644 --- a/tests/Unit/Service/InsightsServiceTest.php +++ b/tests/Unit/Service/InsightsServiceTest.php @@ -46,7 +46,7 @@ protected function setUp(): void { // can key on the uid without standing up fake user objects. $userManager->method('get')->willReturn(null); - $this->employees->method('listInGroup')->willReturn(['alice', 'bob', 'carol']); + $this->employees->method('listActiveInGroup')->willReturn(['alice', 'bob', 'carol']); $this->managerResolver->method('getManagerUidsOf')->willReturnCallback( static fn (array $uids): array => array_combine($uids, array_map(static fn (string $uid): ?string => $uid === 'carol' ? null : 'mgr1', $uids)), );