77use Illuminate \Support \Facades \Hash ;
88use Javaabu \Auth \Tests \InteractsWithDatabase ;
99use Javaabu \Auth \Tests \TestCase ;
10+ use PHPUnit \Framework \Attributes \Test ;
1011use Spatie \Activitylog \Models \Activity ;
1112
1213class LoginControllerTest extends TestCase
@@ -22,15 +23,15 @@ public function setUp(): void
2223 $ this ->seedDefaultUsers ();
2324 }
2425
25- /** @test */
26+ #[Test]
2627 public function it_can_show_the_login_form_page (): void
2728 {
2829 $ this ->get ('/login ' )
2930 ->assertStatus (200 )
3031 ->assertViewIs ('login ' );
3132 }
3233
33- /** @test */
34+ #[Test]
3435 public function it_can_login_a_user (): void
3536 {
3637 $ user = $ this ->getUser ('user@example.com ' );
@@ -45,7 +46,7 @@ public function it_can_login_a_user(): void
4546 $ this ->assertEquals ($ user ->id , Auth::guard ('web ' )->id ());
4647 }
4748
48- /** @test */
49+ #[Test]
4950 public function it_records_the_login_event ()
5051 {
5152 $ now = '2024-09-08 12:56:00 ' ;
@@ -85,7 +86,7 @@ public function it_records_the_login_event()
8586 ]);
8687 }
8788
88- /** @test */
89+ #[Test]
8990 public function it_can_logout_a_user (): void
9091 {
9192 $ this ->withoutExceptionHandling ();
@@ -108,7 +109,7 @@ public function it_can_logout_a_user(): void
108109 $ this ->assertNull (Auth::guard ('web ' )->id (), 'Invalid logged in user id ' );
109110 }
110111
111- /** @test */
112+ #[Test]
112113 public function it_records_logout_events (): void
113114 {
114115 $ this ->withoutExceptionHandling ();
@@ -146,7 +147,7 @@ public function it_records_logout_events(): void
146147 ]);
147148 }
148149
149- /** @test */
150+ #[Test]
150151 public function it_can_validate_the_login_inputs ()
151152 {
152153 $ this ->post ('/login ' , [
@@ -156,7 +157,7 @@ public function it_can_validate_the_login_inputs()
156157 ->assertSessionHasErrors ('password ' , 'email ' );
157158 }
158159
159- /** @test */
160+ #[Test]
160161 public function it_does_not_allow_a_user_to_be_logged_in_using_an_invalid_password ()
161162 {
162163 $ this ->post ('/login ' , [
@@ -168,7 +169,7 @@ public function it_does_not_allow_a_user_to_be_logged_in_using_an_invalid_passwo
168169 $ this ->assertNull (Auth::guard ('web ' )->id (), 'Invalid logged in user id ' );
169170 }
170171
171- /** @test */
172+ #[Test]
172173 public function it_records_failed_login_events ()
173174 {
174175 $ now = '2024-09-08 12:56:00 ' ;
@@ -202,7 +203,7 @@ public function it_records_failed_login_events()
202203 ]);
203204 }
204205
205- /** @test */
206+ #[Test]
206207 public function it_increments_the_users_login_attempts_if_an_invalid_password_is_entered ()
207208 {
208209 $ user = $ this ->getUser ('user@example.com ' );
@@ -226,7 +227,7 @@ public function it_increments_the_users_login_attempts_if_an_invalid_password_is
226227 ]);
227228 }
228229
229- /** @test */
230+ #[Test]
230231 public function it_records_lockout_events ()
231232 {
232233 $ now = '2024-09-08 12:56:00 ' ;
@@ -255,7 +256,7 @@ public function it_records_lockout_events()
255256 ]);
256257 }
257258
258- /** @test */
259+ #[Test]
259260 public function it_resets_the_login_attempts_when_the_correct_password_is_entered ()
260261 {
261262 $ this ->withoutExceptionHandling ();
@@ -284,7 +285,7 @@ public function it_resets_the_login_attempts_when_the_correct_password_is_entere
284285 ]);
285286 }
286287
287- /** @test */
288+ #[Test]
288289 public function it_does_not_reset_the_login_attempts_if_the_user_is_already_locked_out_even_when_the_correct_password_is_entered ()
289290 {
290291 $ user = $ this ->getUser ('user@example.com ' );
@@ -312,7 +313,7 @@ public function it_does_not_reset_the_login_attempts_if_the_user_is_already_lock
312313 ]);
313314 }
314315
315- /** @test */
316+ #[Test]
316317 public function it_shows_a_lock_out_message_if_there_are_too_many_login_attempts ()
317318 {
318319 $ this ->withoutExceptionHandling ();
0 commit comments