Skip to content

Commit 3913030

Browse files
committed
wip
Signed-off-by: Mior Muhammad Zaki <[email protected]>
1 parent 7b7bc21 commit 3913030

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed

tests/Browser/Auth/AuthenticationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
test('login screen can be rendered', function () {
1111
visit(route('login'))
12-
->assertNoConsoleLogs()
13-
->assertNoJavaScriptErrors()
1412
->assertSee('Log in to your account')
15-
->assertSee('Enter your email and password below to log in');
13+
->assertSee('Enter your email and password below to log in')
14+
->assertNoConsoleLogs()
15+
->assertNoJavaScriptErrors();
1616
});
1717

1818
test('users_can_authenticate_using_the_login_screen', function () {
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,81 @@
11
<?php
2+
3+
use App\Models\User;
4+
use Illuminate\Auth\Notifications\ResetPassword;
5+
use Illuminate\Support\Facades\Notification;
6+
7+
test('reset password link screen can be rendered', function () {
8+
visit(route('password.request'))
9+
->assertSee('Forgot password')
10+
->assertSee('Enter your email to receive a password reset link')
11+
->assertNoConsoleLogs()
12+
->assertNoJavaScriptErrors();
13+
});
14+
15+
test('test_reset_password_link_can_be_requested', function () {
16+
Notification::fake();
17+
18+
$user = User::factory()->create();
19+
20+
visit(route('password.request'))
21+
->fill('email', $user->email)
22+
->press('Email password reset link')
23+
->assertSee('A reset link will be sent if the account exists.');
24+
25+
Notification::assertSentTo($user, ResetPassword::class);
26+
});
27+
28+
// public function test_reset_password_screen_can_be_rendered()
29+
// {
30+
// Notification::fake();
31+
32+
// $user = User::factory()->create();
33+
34+
// $this->post(route('password.email'), ['email' => $user->email]);
35+
36+
// Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
37+
// $response = $this->get(route('password.request', $notification->token));
38+
39+
// $response->assertStatus(200);
40+
41+
// return true;
42+
// });
43+
// }
44+
45+
// public function test_password_can_be_reset_with_valid_token()
46+
// {
47+
// Notification::fake();
48+
49+
// $user = User::factory()->create();
50+
51+
// $this->post(route('password.email'), ['email' => $user->email]);
52+
53+
// Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) {
54+
// $response = $this->post(route('password.store'), [
55+
// 'token' => $notification->token,
56+
// 'email' => $user->email,
57+
// 'password' => 'password',
58+
// 'password_confirmation' => 'password',
59+
// ]);
60+
61+
// $response
62+
// ->assertSessionHasNoErrors()
63+
// ->assertRedirect(route('login'));
64+
65+
// return true;
66+
// });
67+
// }
68+
69+
// public function test_password_cannot_be_reset_with_invalid_token(): void
70+
// {
71+
// $user = User::factory()->create();
72+
73+
// $response = $this->post(route('password.store'), [
74+
// 'token' => 'invalid-token',
75+
// 'email' => $user->email,
76+
// 'password' => 'newpassword123',
77+
// 'password_confirmation' => 'newpassword123',
78+
// ]);
79+
80+
// $response->assertSessionHasErrors('email');
81+
// }

0 commit comments

Comments
 (0)