| Conditions | 1 |
| Paths | 1 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 31 | public function testLoginWithInactiveUser() |
||
| 32 | { |
||
| 33 | // We create 1 inactive employee |
||
| 34 | $user = factory(Employee::class)->make(); |
||
| 35 | $user->password = bcrypt('teste123'); |
||
| 36 | $user->active = false; |
||
| 37 | $user->save(); |
||
| 38 | |||
| 39 | //When we try to login with an inactive employee |
||
| 40 | $credentials = [ |
||
| 41 | 'login' => $user->email, |
||
| 42 | 'password' => 'teste123', |
||
| 43 | ]; |
||
| 44 | |||
| 45 | $response = $this->json('POST', $this->authUri, $credentials); |
||
| 46 | |||
| 47 | // It should return an error inactive |
||
| 48 | $response |
||
| 49 | ->assertStatus(401) |
||
| 50 | ->assertJson([ 'error' => 'inactive' ]); |
||
| 51 | } |
||
| 53 |