Last active
May 22, 2018 20:57
-
-
Save DCzajkowski/7caa2cee90d883812c7f1c0de6b9da1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ... | |
class LoginTest extends TestCase | |
{ | |
// ... | |
public function test_user_cannot_login_with_incorrect_password() | |
{ | |
$user = factory(User::class)->create([ | |
'password' => bcrypt('i-love-laravel'), | |
]); | |
$response = $this->from('/login')->post('/login', [ | |
'email' => $user->email, | |
'password' => 'invalid-password', | |
]); | |
$response->assertRedirect('/login'); | |
$response->assertSessionHasErrors('email'); | |
$this->assertTrue(session()->hasOldInput('email')); | |
$this->assertFalse(session()->hasOldInput('password')); | |
$this->assertGuest(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment