| Total Complexity | 3 |
| Total Lines | 86 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | final class AuthCest |
||
| 12 | { |
||
| 13 | public function auth(AcceptanceTester $I): void |
||
| 14 | { |
||
| 15 | $I->haveHttpHeader('Content-Type', 'application/json'); |
||
| 16 | $I->sendPOST( |
||
| 17 | '/auth/', |
||
| 18 | [ |
||
| 19 | 'login' => 'Opal1144', |
||
| 20 | 'password' => 'Opal1144', |
||
| 21 | ] |
||
| 22 | ); |
||
| 23 | $I->seeResponseCodeIs(HttpCode::OK); |
||
| 24 | $I->seeResponseIsJson(); |
||
| 25 | $I->seeResponseContainsJson( |
||
| 26 | [ |
||
| 27 | 'status' => 'success', |
||
| 28 | 'error_message' => '', |
||
| 29 | 'error_code' => null, |
||
| 30 | ] |
||
| 31 | ); |
||
| 32 | |||
| 33 | $response = Json::decode($I->grabResponse()); |
||
| 34 | $I->seeInDatabase( |
||
| 35 | 'user', |
||
| 36 | [ |
||
| 37 | 'id' => 1, |
||
| 38 | 'token' => $response['data']['token'], |
||
| 39 | ] |
||
| 40 | ); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function logout(AcceptanceTester $I): void |
||
| 69 | ] |
||
| 70 | ); |
||
| 71 | } |
||
| 72 | |||
| 73 | public function logoutWithBadToken(AcceptanceTester $I): void |
||
| 101 |