init(); $this->withoutExceptionHandling(); $user = User::factory()->create(['email' => 'mail@example.com', 'password' => Hash::make('secret')]); $this->post('/login', [ 'email' => 'mail@example.com', 'password' => 'secret', ]); $this->assertAuthenticated(); } public function testItThrowsExceptionWhenLoginFailed(): void { $this->init(); $user = User::factory()->create(['email' => 'mail@example.com', 'password' => Hash::make('secret')]); $this->post('/login', [ 'email' => 'mail@example.com', 'password' => 'wrong', ])->assertRedirect('/'); $this->assertFalse(auth()->check()); } }