Skip to content

Commit e00b3a2

Browse files
Cannonb4llclaude
andcommitted
Fix ProfileEmailValidationTest for Filament v4
Specify form name in fillForm/assertHasFormErrors calls since the Profile component implements both HasForms and HasTable, causing Filament v4 to default to the table's deferred filters form. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 701fec8 commit e00b3a2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/Feature/ProfileEmailValidationTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
'email' => 'invalid-email',
2626
'notification_settings' => [],
2727
'per_page_setting' => [5],
28-
])
28+
], 'form')
2929
->call('submit')
30-
->assertHasFormErrors(['email']);
30+
->assertHasFormErrors(['email'], 'form');
3131
});
3232

3333
test('profile form validates email uniqueness', function () {
@@ -40,9 +40,9 @@
4040
'email' => 'taken@example.com',
4141
'notification_settings' => [],
4242
'per_page_setting' => [5],
43-
])
43+
], 'form')
4444
->call('submit')
45-
->assertHasFormErrors(['email']);
45+
->assertHasFormErrors(['email'], 'form');
4646
});
4747

4848
test('user can keep their current email without validation error', function () {
@@ -53,9 +53,9 @@
5353
'email' => $this->user->email,
5454
'notification_settings' => [],
5555
'per_page_setting' => [5],
56-
])
56+
], 'form')
5757
->call('submit')
58-
->assertHasNoFormErrors();
58+
->assertHasNoFormErrors([], 'form');
5959

6060
expect($this->user->fresh()->email)->toBe('original@example.com');
6161
});
@@ -70,7 +70,7 @@
7070
'email' => 'newemail@example.com',
7171
'notification_settings' => [],
7272
'per_page_setting' => [5],
73-
])
73+
], 'form')
7474
->call('submit');
7575

7676
$this->user->refresh();
@@ -91,7 +91,7 @@
9191
'email' => 'newemail@example.com',
9292
'notification_settings' => [],
9393
'per_page_setting' => [5],
94-
])
94+
], 'form')
9595
->call('submit')
9696
->assertNotified();
9797
});
@@ -183,9 +183,9 @@
183183
'email' => 'not-an-email',
184184
'notification_settings' => [],
185185
'per_page_setting' => [5],
186-
])
186+
], 'form')
187187
->call('submit')
188-
->assertHasFormErrors(['email']);
188+
->assertHasFormErrors(['email'], 'form');
189189

190190
expect($this->user->fresh()->email)->toBe('original@example.com');
191191
});

0 commit comments

Comments
 (0)