You are here

protected function XMLSitemapTestHelper::assertNoResponse in XML sitemap 7.2

Same name and namespace in other branches
  1. 6.2 xmlsitemap.test \XMLSitemapTestHelper::assertNoResponse()

Assert the page does not respond with the specified response code.

Parameters

string $code: Response code. For example 200 is a successful page request. For a list of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.

string $message: Message to display.

Return value

string Assertion result.

Overrides DrupalWebTestCase::assertNoResponse

File

./xmlsitemap.test, line 56
Unit tests for the xmlsitemap.

Class

XMLSitemapTestHelper
Helper test class with some added functions for testing.

Code

protected function assertNoResponse($code, $message = '') {
  $curl_code = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
  $match = is_array($code) ? in_array($curl_code, $code) : $curl_code == $code;
  return $this
    ->assertFalse($match, $message ? $message : t('HTTP response not expected !code, actual !curl_code', array(
    '!code' => $code,
    '!curl_code' => $curl_code,
  )), t('Browser'));
}