Skip to content

Instantly share code, notes, and snippets.

@DCzajkowski
Last active May 22, 2018 20:57
Show Gist options
  • Save DCzajkowski/e8ea9d02ce3a490e9109c7160a2fbb3e to your computer and use it in GitHub Desktop.
Save DCzajkowski/e8ea9d02ce3a490e9109c7160a2fbb3e to your computer and use it in GitHub Desktop.
<?php
// ...
class LoginTest extends TestCase
{
// ...
public function test_remember_me_functionality()
{
$user = factory(User::class)->create([
'id' => random_int(1, 100),
'password' => bcrypt($password = 'i-love-laravel'),
]);
$response = $this->post('/login', [
'email' => $user->email,
'password' => $password,
'remember' => 'on',
]);
$response->assertRedirect('/home');
// cookie assertion goes here
$this->assertAuthenticatedAs($user);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment