protected function RESTTestBase::assertResponse in Drupal 8
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 \Drupal\Component\Render\FormattableMarkup 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.
Overrides WebTestBase::assertResponse
File
- core/
modules/ rest/ src/ Tests/ RESTTestBase.php, line 250
Class
- RESTTestBase
- Test helper class that provides a REST client method to send HTTP requests.
Namespace
Drupal\rest\TestsCode
protected function assertResponse($code, $message = '', $group = 'Browser') {
if (!isset($this->response)) {
return parent::assertResponse($code, $message, $group);
}
return $this
->assertEqual($code, $this->response
->getStatusCode(), $message ? $message : "HTTP response expected {$code}, actual {$this->response->getStatusCode()}", $group);
}