Example #1
0
 private function assertErrorMessage(Result $apiResult, $code, $type, $message, $detail)
 {
     $response = json_decode($apiResult->createResponse()->getContent());
     $this->checkResponseFieldMeta($response, 'http_code', $code, \PHPUnit_Framework_Constraint_IsType::TYPE_INT);
     if (is_null($type)) {
         $this->assertObjectHasAttribute('error_type', $response->meta);
         $this->assertNull($response->meta->error_type);
     } else {
         $this->checkResponseFieldMeta($response, 'error_type', $type, \PHPUnit_Framework_Constraint_IsType::TYPE_STRING);
     }
     if (is_null($message)) {
         $this->assertObjectHasAttribute('error_message', $response->meta);
         $this->assertNull($response->meta->error_message);
     } else {
         $this->checkResponseFieldMeta($response, 'error_message', $message, \PHPUnit_Framework_Constraint_IsType::TYPE_STRING);
     }
     if (is_null($detail)) {
         $this->assertObjectHasAttribute('error_details', $response->meta);
         $this->assertNull($response->meta->error_details);
     } else {
         $this->checkResponseFieldMeta($response, 'error_details', $detail, \PHPUnit_Framework_Constraint_IsType::TYPE_STRING);
     }
 }