Guest User

Untitled

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