protected function assertHttpResponseCodeEquals(HttpResponse $response, $expected)
{
$responseCode = $response->getStatusCode();
if ($responseCode != $expected) {
$errorMessageString = '';
if (strpos($response->getHeader('Content-Type'), 'application/vnd.ez.api.ErrorMessage+xml') !== false) {
$body = \simplexml_load_string($response->getContent());
$errorMessageString = $this->getHttpResponseCodeErrorMessage($body);
} elseif (strpos($response->getHeader('Content-Type'), 'application/vnd.ez.api.ErrorMessage+json') !== false) {
$body = json_decode($response->getContent());
$errorMessageString = $this->getHttpResponseCodeErrorMessage($body->ErrorMessage);
}
self::assertEquals($expected, $responseCode, $errorMessageString);
}
}