add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
+8 -6
View File
@@ -10,7 +10,9 @@ use RuntimeException;
class StaffCommandService
{
public function __construct(private GlobalConfigService $configService) {}
public function __construct(private GlobalConfigService $configService)
{
}
public function create(array $payload): Staff
{
@@ -19,7 +21,7 @@ class StaffCommandService
$roleName = (string) ($payload['role_name'] ?? '');
$activeRole = strtolower($roleName);
if (! empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
if (!empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
$activeRole = 'inactive';
}
@@ -38,7 +40,7 @@ class StaffCommandService
'updated_at' => now(),
]);
if (! $staff) {
if (!$staff) {
throw new RuntimeException('Failed to create staff member.');
}
@@ -59,13 +61,13 @@ class StaffCommandService
if (array_key_exists('role_name', $updates)) {
$updates['active_role'] = strtolower((string) $updates['role_name']);
}
if (! empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
if (!empty($payload['status']) && strtolower((string) $payload['status']) === 'inactive') {
$updates['active_role'] = 'inactive';
}
$updates['updated_at'] = now();
if (! empty($updates)) {
if (!empty($updates)) {
$staff->fill($updates);
$staff->save();
}
@@ -81,7 +83,7 @@ class StaffCommandService
private function resolveUserId(array $payload): int
{
if (! empty($payload['user_id'])) {
if (!empty($payload['user_id'])) {
return (int) $payload['user_id'];
}