Example #1
1
 public function testGrabDataFromResponseByJsonPath()
 {
     $this->module->sendGET('/rest/user/');
     // simple assoc array
     $this->assertEquals(['*****@*****.**'], $this->module->grabDataFromResponseByJsonPath('$.email'));
     // nested assoc array
     $this->assertEquals(['Kyiv'], $this->module->grabDataFromResponseByJsonPath('$.address.city'));
     // nested index array
     $this->assertEquals(['DavertMik'], $this->module->grabDataFromResponseByJsonPath('$.aliases[0]'));
     // empty if data not found
     $this->assertEquals([], $this->module->grabDataFromResponseByJsonPath('$.address.street'));
 }
Example #2
1
 function apiActivateAgency()
 {
     $this->restModule->haveHttpHeader('Content-Type', 'application/json');
     $this->restModule->haveHttpHeader('token', User::getAdminToken());
     $this->restModule->sendPUT('/users/' . User::getUserId(3) . '/change-status', ['status' => 1]);
     $agency_data = $this->restModule->grabResponse();
     $agency_token = $this->restModule->grabDataFromResponseByJsonPath('$.token');
     file_put_contents(codecept_data_dir('agency_data.json'), $agency_data);
     file_put_contents(codecept_data_dir('agency_token.json'), $agency_token);
 }