Guest User

Untitled

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