haveHttpHeader('User-Agent', 'FEIP Tester'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST( '/index.php', [ '{ "bar": "asd", "email": "test@mail.ru", "users": [ { "first_name": "Arsen", "second_name": "Mirzaev", "age": "19" } ] }' ] ); $I->seeResponseContains('{"response":{"bar":"asd","email":"test@mail.ru","users":{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19}},"errors":[]}'); } public function tryPostJsonToFilterButUsersHasSecond(BarTester $I) { $I->haveHttpHeader('User-Agent', 'FEIP Tester'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST( '/index.php', [ '{ "bar": "asd", "email": "test@mail.ru", "users": [ { "first_name": "Arsen", "second_name": "Mirzaev", "age": "19" }, { "first_name": "Ivan", "second_name": "Voronkov", "age": "18" } ] }' ] ); $I->seeResponseContains('{"response":{"bar":"asd","email":"test@mail.ru","users":[{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19},{"first_name":["Ivan"],"second_name":["Voronkov"],"age":18}]},"errors":[]}'); } public function tryPostJsonToFilterButBarIsArray(BarTester $I) { $I->haveHttpHeader('User-Agent', 'FEIP Tester'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST( '/index.php', [ '{ "bar": [ { "first_name": "Arsen", "second_name": "Mirzaev", "age": "19" } ], "email": "test@mail.ru", "users": [ { "first_name": "Arsen", "second_name": "Mirzaev", "age": "19" } ] }' ] ); $I->seeResponseContains('{"response":{"bar":"","email":"test@mail.ru","users":{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19}},"errors":[{"type":200,"target":"bar","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}'); } public function tryPostJsonToFilterButEmailHasWrongValue(BarTester $I) { $I->haveHttpHeader('User-Agent', 'FEIP Tester'); $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded'); $I->sendPOST( '/index.php', [ '{ "bar": "asd", "email": "test@mail", "users": [ { "first_name": "Arsen", "second_name": "Mirzaev", "age": "19" } ] }' ] ); $I->seeResponseContains('{"response":{"bar":"asd","email":"test@mail","users":{"first_name":["Arsen"],"second_name":["Mirzaev"],"age":19}},"errors":[{"type":200,"target":"email","value":"\u041d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430"}]}'); } }