function DrupalWebTestCase::assertResponse
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.
150 calls to DrupalWebTestCase::assertResponse()
- AccessDeniedTestCase::testAccessDenied in modules/
system/ system.test - AddFeedTestCase::testAddFeed in modules/
aggregator/ aggregator.test - Creates and ensures that a feed is unique, checks source, and deletes feed.
- AddFeedTestCase::testAddLongFeed in modules/
aggregator/ aggregator.test - Tests feeds with very long URLs.
- AggregatorTestCase::updateFeedItems in modules/
aggregator/ aggregator.test - Updates the feed items.
- BasicMinimalUpdatePath::testBasicMinimalUpdate in modules/
simpletest/ tests/ upgrade/ upgrade.test - Tests a successful point release update.
File
-
modules/
simpletest/ drupal_web_test_case.php, line 3939
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'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.