DrupalWebTestCase::assertResponse

  1. drupal
    1. 8
    2. 7
Versions
7 protected DrupalWebTestCase::assertResponse($code, $message = '')

Asserts the page responds with the specified response code.

Parameters

$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.

$message Message to display.

Return value

Assertion result.

Code

modules/simpletest/drupal_web_test_case.php, line 3274

<?php
protected function assertResponse($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->assertTrue($match, $message ? $message : t('HTTP response expected !code, actual !curl_code', array('!code' => $code, '!curl_code' => $curl_code)), t('Browser'));
}
?>