fix tests

This commit is contained in:
root
2026-06-11 11:46:12 -04:00
parent c91fa2ce4d
commit 5ead80fdc7
1489 changed files with 11349 additions and 10305 deletions
+8 -8
View File
@@ -16,9 +16,9 @@ class RoleStaffService
static fn ($role) => trim((string) $role),
$newRoleNames
),
static fn ($role) => $role !== '' && !in_array(strtolower($role), $excludedRoles, true)
static fn ($role) => $role !== '' && ! in_array(strtolower($role), $excludedRoles, true)
)));
$activeRole = !empty($staffRoles) ? strtolower((string) $staffRoles[0]) : 'inactive';
$activeRole = ! empty($staffRoles) ? strtolower((string) $staffRoles[0]) : 'inactive';
$email = $this->generateUniqueStaffEmail($user->firstname ?? '', $user->lastname ?? '', (int) $user->id);
@@ -34,7 +34,7 @@ class RoleStaffService
];
$saved = Staff::upsertStaff($payload);
if (!$saved) {
if (! $saved) {
Log::warning('Failed to upsert staff record.', ['user_id' => $user->id]);
}
}
@@ -50,7 +50,7 @@ class RoleStaffService
$out = '';
foreach ($roles as $role) {
$next = $out === '' ? $role : $out . ', ' . $role;
$next = $out === '' ? $role : $out.', '.$role;
if (strlen($next) > $maxLength) {
break;
}
@@ -73,18 +73,18 @@ class RoleStaffService
$email = '';
for ($i = $min; $i <= $max; $i++) {
$base = substr($firstname, 0, $i) . $lastname;
$email = $base . $domain;
$base = substr($firstname, 0, $i).$lastname;
$email = $base.$domain;
$exists = Staff::query()
->where('email', $email)
->where('user_id', '!=', $userId)
->exists();
if (!$exists) {
if (! $exists) {
return $email;
}
}
return $base . $userId . $domain;
return $base.$userId.$domain;
}
}