| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function testLoginWithValidCredentials() |
||
| 16 | { |
||
| 17 | // We create one new employee and save it on the database |
||
| 18 | $user = factory(Employee::class)->create(); |
||
| 19 | $user->password = 'teste123'; |
||
| 20 | |||
| 21 | // When we try to login with his credentials |
||
| 22 | $credentials = [ |
||
| 23 | 'login' => $user->email, |
||
| 24 | 'password' => $user->password, |
||
| 25 | ]; |
||
| 26 | |||
| 27 | $response = $this->json('POST', $this->authUri, $credentials); |
||
| 28 | |||
| 29 | // It should return a JWT token |
||
| 30 | $response |
||
| 31 | ->assertStatus(200) |
||
| 32 | ->assertJsonStructure([ 'token' ]); |
||
| 33 | } |
||
| 35 |