Guest User

Untitled

a guest
May 27th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2.  
  3. // ...
  4.  
  5. class LoginTest extends TestCase
  6. {
  7. // ...
  8.  
  9. public function test_user_can_login_with_correct_credentials()
  10. {
  11. $user = factory(User::class)->create([
  12. 'password' => bcrypt($password = 'i-love-laravel'),
  13. ]);
  14.  
  15. $response = $this->post('/login', [
  16. 'email' => $user->email,
  17. 'password' => $password,
  18. ]);
  19.  
  20. $response->assertRedirect('/home');
  21. $this->assertAuthenticatedAs($user);
  22. }
  23. }
Add Comment
Please, Sign In to add comment