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
+11 -11
View File
@@ -12,9 +12,7 @@ use Illuminate\Support\Facades\Validator;
class UserManagementService
{
public function __construct(private UserEventService $eventService)
{
}
public function __construct(private UserEventService $eventService) {}
public function create(array $payload, ?int $actorId = null): array
{
@@ -45,7 +43,7 @@ class UserManagementService
public function update(int $userId, array $payload): array
{
$user = User::query()->find($userId);
if (!$user) {
if (! $user) {
return ['ok' => false, 'message' => 'User not found.'];
}
@@ -67,7 +65,7 @@ class UserManagementService
public function delete(int $userId): array
{
$user = User::query()->find($userId);
if (!$user) {
if (! $user) {
return ['ok' => false, 'message' => 'User not found.'];
}
@@ -87,11 +85,11 @@ class UserManagementService
{
$actorId = $actorId ?? (auth()->id() ?? null);
if (!User::query()->whereKey($userId)->exists()) {
if (! User::query()->whereKey($userId)->exists()) {
return false;
}
if (!Role::query()->whereKey($roleId)->exists()) {
if (! Role::query()->whereKey($roleId)->exists()) {
return false;
}
@@ -133,10 +131,10 @@ class UserManagementService
'accept_school_policy' => ['required'],
];
$isParent = !empty($data['is_parent']);
$noSecondParent = !empty($data['no_second_parent_info']);
$isParent = ! empty($data['is_parent']);
$noSecondParent = ! empty($data['no_second_parent_info']);
if ($isParent && !$noSecondParent) {
if ($isParent && ! $noSecondParent) {
$rules += [
'second_firstname' => ['required', 'regex:/^[a-zA-Z\\s\\-]+$/', 'min:2', 'max:30'],
'second_lastname' => ['required', 'regex:/^[a-zA-Z\\s\\-]+$/', 'min:2', 'max:30'],
@@ -215,7 +213,7 @@ class UserManagementService
];
foreach ($map as $field) {
if (!array_key_exists($field, $payload)) {
if (! array_key_exists($field, $payload)) {
continue;
}
@@ -265,6 +263,7 @@ class UserManagementService
if ($value === 'female') {
return 'Female';
}
return null;
}
@@ -274,6 +273,7 @@ class UserManagementService
if ($value === '') {
return '';
}
return ucfirst($value);
}