Beautiful Open-Source Form Builder
<?php
use App\Models\User;
it('checks email uniqueness using the normalized address', function () {
$user = $this->actingAsUser();
User::factory()->create(['email' => '[email protected]']);
$this->patchJson('/settings/profile', [
'name' => $user->name,
'email' => '[email protected]',
'current_password' => 'Abcd@1234',
])->assertUnprocessable()->assertJsonValidationErrors('email');
expect($user->fresh()->email)->not->toBe('[email protected]');
});