예제 #1
1
 public function testJsonTypeMatchesWithJsonPath()
 {
     $this->module->response = '{"users": [{ "name": "davert"}, {"id": 1}]}';
     $this->module->seeResponseMatchesJsonType(['name' => 'string'], '$.users[0]');
     $this->module->seeResponseMatchesJsonType(['id' => 'integer'], '$.users[1]');
     $this->module->dontSeeResponseMatchesJsonType(['id' => 'integer'], '$.users[0]');
 }
예제 #2
1
 function apiAgencyEditServices()
 {
     $agencyToken = file_get_contents(codecept_data_dir('agency_token.json'));
     $certificate1 = file_get_contents(codecept_data_dir() . 'certificate_id.json');
     $this->restModule->haveHttpHeader('token', $agencyToken);
     $this->restModule->haveHttpHeader('Content-Type', 'application/json');
     $this->restModule->sendPOST('/profiles/agencies/services/edit', ['services' => [['title' => User::$serviceTitle1, 'description' => User::$serviceDescription1], ['title' => User::$serviceTitle2, 'description' => User::$serviceDescription2]], 'certificates' => [['title' => User::$certificateTitle1, 'image' => $certificate1]]]);
     $this->restModule->seeResponseIsJson();
     $this->restModule->seeResponseCodeIs(200);
     $this->restModule->seeResponseMatchesJsonType(['id' => 'string', 'name' => 'string', 'subdomain' => 'string', 'firstName' => 'string', 'lastName' => 'string', 'email' => 'string', 'certificates' => 'array', 'services' => 'array']);
 }