Теперь при передаче запроса как json, закодированный в теле, он автоматически парсится

This commit is contained in:
ErickSkrauch
2017-05-31 03:10:22 +03:00
parent 30fedc51ef
commit 400f0e87b9
14 changed files with 94 additions and 57 deletions

View File

@ -38,6 +38,17 @@ class AuthorizationCest {
$this->testSuccessResponse($I);
}
public function byNamePassedViaPOSTBody(FunctionalTester $I) {
$I->wantTo('authenticate by username and password sent via post body');
$this->route->authenticate(json_encode([
'username' => 'admin',
'password' => 'password_0',
'clientToken' => Uuid::uuid4()->toString(),
]));
$this->testSuccessResponse($I);
}
public function byEmailWithEnabledTwoFactorAuth(FunctionalTester $I) {
$I->wantTo('get valid error by authenticate account with enabled two factor auth');
$this->route->authenticate([

View File

@ -98,17 +98,6 @@ class UsernamesToUuidsCest {
]);
}
public function passWrongPostBody(FunctionalTester $I) {
$I->wantTo('get specific response when pass invalid json string');
$this->route->uuidsByUsernames('wrong-json');
$I->canSeeResponseCodeIs(400);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([
'error' => 'IllegalArgumentException',
'errorMessage' => 'Passed array of profile names is an invalid JSON string.',
]);
}
private function validateFewValidUsernames(FunctionalTester $I) {
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();