You are here

protected function DrupalWebTestCase::assertResponse in SimpleTest 7

Same name and namespace in other branches
  1. 6.2 drupal_web_test_case.php \DrupalWebTestCase::assertResponse()
  2. 7.2 drupal_web_test_case.php \DrupalWebTestCase::assertResponse()

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

11 calls to DrupalWebTestCase::assertResponse()
BootstrapPageCacheTestCase::testConditionalRequests in tests/bootstrap.test
Test support for requests containing If-Modified-Since and If-None-Match headers.
DrupalErrorHandlerUnitTest::testErrorHandler in tests/error.test
Test the error handler.
FileDownloadTest::testPrivateFileTransfer in tests/file.test
Test the private file transfer system.
FileDownloadTest::testPublicFileTransfer in tests/file.test
Test the public file transfer system.
FileSaveUploadTest::setUp in tests/file.test
Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…

... See full list

File

./drupal_web_test_case.php, line 2475

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

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'));
}