Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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();
- }
- }
Add Comment
Please, Sign In to add comment