protected function WebTestBase::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: (optional) A message to display with the assertion. Do not translate messages: use format_string() to embed variables in the message text, not t(). If left blank, a default message will be displayed.

$group: (optional) The group this message is in, which is displayed in a column in test output. Use 'Debug' to indicate this is debugging output. Do not translate this string. Defaults to 'Browser'; most tests do not override this default.

Return value

Assertion result.

145 calls to WebTestBase::assertResponse()
AccessDeniedTest::testAccessDenied in drupal/core/modules/system/lib/Drupal/system/Tests/System/AccessDeniedTest.php
AddFeedTest::testAddFeed in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php
Create a feed, ensure that it is unique, check the source, and delete the feed.
AddFeedTest::testAddLongFeed in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AddFeedTest.php
Tests feeds with very long URLs.
AggregatorTestBase::updateFeedItems in drupal/core/modules/aggregator/lib/Drupal/aggregator/Tests/AggregatorTestBase.php
Update feed items (simulate click to admin/config/services/aggregator/update/$fid).
BareMinimalUpgradePathTest::testBasicMinimalUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalUpgradePathTest.php
Tests a successful major version release upgrade.

... See full list

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 2956
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertResponse($code, $message = '', $group = 'Browser') {
  $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,
  )), $group);
}