Добавлены тесты для ответа сервера о истёкшем токене

Добавлены doc-блоки для поведений в базовом контроллере
This commit is contained in:
ErickSkrauch
2016-05-30 21:11:22 +03:00
parent bdc96d82c1
commit cb038c897b
3 changed files with 29 additions and 12 deletions

View File

@ -34,4 +34,22 @@ class AccountsCurrentCest {
$I->canSeeResponseJsonMatchesJsonPath('$.passwordChangedAt');
}
public function testExpiredCurrent(FunctionalTester $I) {
// Устанавливаем заведомо истёкший токен
$I->amBearerAuthenticated(
'eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJodHRwOlwvXC9sb2NhbGhvc3QiLCJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3QiLCJpYXQiO' .
'jE0NjQ2Mjc1NDUsImV4cCI6MTQ2NDYzMTE0NSwianRpIjoxfQ.9c1mm0BK-cuW1qh15F12s2Fh37IN43YeeZeU4DFtlrE'
);
$this->route->current();
$I->canSeeResponseCodeIs(401);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'name' => 'Unauthorized',
'message' => 'Token expired',
'code' => 0,
'status' => 401,
]);
}
}