You are here

protected function WebTestBase::assertNoResponse in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::assertNoResponse()

Asserts the page did not return 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 \Drupal\Component\Utility\SafeMarkup::format() 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.

1 call to WebTestBase::assertNoResponse()
BreadcrumbTest::testBreadCrumbs in core/modules/system/src/Tests/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.

File

core/modules/simpletest/src/WebTestBase.php, line 2773
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function assertNoResponse($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
    ->assertFalse($match, $message ? $message : SafeMarkup::format('HTTP response not expected @code, actual @curl_code', array(
    '@code' => $code,
    '@curl_code' => $curl_code,
  )), $group);
}