Skip to content

Commit 8036f92

Browse files
committed
test: check show validate errors in MagicLink
1 parent 7bc38cf commit 8036f92

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/Authentication/MagicLinkTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ public function testMagicLinkSubmitNoEmail(): void
5050
]);
5151

5252
$result->assertRedirectTo(route_to('magic-link'));
53-
$result->assertSessionHas('error', lang('Auth.invalidEmail'));
53+
$expected = ['email' => 'The Email Address field is required.'];
54+
55+
$result->assertSessionHas('errors', $expected);
5456
}
5557

5658
public function testMagicLinkSubmitBadEmail(): void

tests/Controllers/MagicLinkTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,15 @@ public function testAfterLoggedInNotAllowDisplayMagicLink()
4646
$result = $this->get('/login/magic-link');
4747
$result->assertRedirectTo(config('Auth')->loginRedirect());
4848
}
49+
50+
public function testShowValidateErrorsInMagicLink()
51+
{
52+
$result = $this->post('/login/magic-link', [
53+
'email' => 'foo@example',
54+
]);
55+
56+
$expected = ['email' => 'The Email Address field must contain a valid email address.'];
57+
58+
$result->assertSessionHas('errors', $expected);
59+
}
4960
}

0 commit comments

Comments
 (0)