get(route('login')); $response->assertStatus(200); } /** * Users can authenticate using the login screen. * * @return void */ public function testUsersCanAuthenticateUsingTheLoginScreen(): void { $user = User::factory()->createOne(); $response = $this->post(route('login'), [ 'email' => $user->email, 'password' => 'password', ]); $this->assertAuthenticated(); $response->assertRedirect(RouteServiceProvider::HOME); } /** * Users cannot authenticate with invalid password. * * @return void */ public function testUsersCanNotAuthenticateWithInvalidPassword(): void { $user = User::factory()->createOne(); $this->post(route('login'), [ 'email' => $user->email, 'password' => 'wrong-password', ]); $this->assertGuest(); } }