daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest May 27th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top