create(); $role = Role::query()->firstOrCreate(['slug' => 'admin'], ['name' => 'مدیر']); $admin->roles()->sync([$role->id]); actingAs($admin); }); it('opens the create user form without the unresolvable-closure error', function (): void { Livewire\Livewire::test(CreateUser::class) ->assertOk(); }); it('accepts a +98 mobile and normalizes it, rejects a malformed one', function (): void { Livewire\Livewire::test(CreateUser::class) ->fillForm([ 'name' => 'کاربر تست', 'email' => 'ok@example.com', 'mobile' => '+98 912 345 6789', 'password' => 'password12', ]) ->call('create') ->assertHasNoFormErrors(); expect(User::query()->where('email', 'ok@example.com')->value('mobile'))->toBe('09123456789'); Livewire\Livewire::test(CreateUser::class) ->fillForm([ 'name' => 'کاربر بد', 'email' => 'bad@example.com', 'mobile' => '123', 'password' => 'password12', ]) ->call('create') ->assertHasFormErrors(['mobile']); });