Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // ...
- class LoginTest extends TestCase
- {
- // ...
- public function test_user_can_login_with_correct_credentials()
- {
- $user = factory(User::class)->create([
- 'password' => bcrypt($password = 'i-love-laravel'),
- ]);
- $response = $this->post('/login', [
- 'email' => $user->email,
- 'password' => $password,
- ]);
- $response->assertRedirect('/home');
- $this->assertAuthenticatedAs($user);
- }
- }
Add Comment
Please, Sign In to add comment