3 namespace Tests\Feature\Auth;
6 use App\Providers\RouteServiceProvider;
7 use Illuminate\Foundation\Testing\RefreshDatabase;
10 class AuthenticationTest extends TestCase
14 public function test_login_screen_can_be_rendered()
16 $response = $this->get('/login');
18 $response->assertStatus(200);
21 public function test_users_can_authenticate_using_the_login_screen()
23 $user = User::factory()->create();
25 $response = $this->post('/login', [
26 'email' => $user->email,
27 'password' => 'password',
30 $this->assertAuthenticated();
31 $response->assertRedirect(RouteServiceProvider::HOME);
34 public function test_users_can_not_authenticate_with_invalid_password()
36 $user = User::factory()->create();
38 $this->post('/login', [
39 'email' => $user->email,
40 'password' => 'wrong-password',