protected function WebTestBase::assertHeader in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::assertHeader()
Check if a HTTP response header exists and has the expected value.
Parameters
string $header: The header key, example: Content-Type
string $value: The header value.
string $message: (optional) A message to display with the assertion.
string $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 'Other'; most tests do not override this default.
Return value
bool TRUE if the assertion succeeded, FALSE otherwise.
13 calls to WebTestBase::assertHeader()
- ContainerRebuildWebTest::testContainerInvalidation in core/
modules/ system/ src/ Tests/ DrupalKernel/ ContainerRebuildWebTest.php - Tests container invalidation.
- ContainerRebuildWebTest::testSetContainerRebuildWithDifferentDeploymentIdentifier in core/
modules/ system/ src/ Tests/ DrupalKernel/ ContainerRebuildWebTest.php - Sets a different deployment identifier.
- DbLogResourceTest::testWatchdog in core/
modules/ dblog/ src/ Tests/ Rest/ DbLogResourceTest.php - Writes a log messages and retrieves it via the REST API.
- HtmlResponseAttachmentsTest::assertTeapotHeaders in core/
modules/ system/ src/ Tests/ Render/ HtmlResponseAttachmentsTest.php - Helper function to make assertions about added HTTP headers.
- HtmlResponseAttachmentsTest::testAttachments in core/
modules/ system/ src/ Tests/ Render/ HtmlResponseAttachmentsTest.php - Test rendering of ['#attached'].
File
- core/
modules/ simpletest/ src/ WebTestBase.php, line 2648 - Contains \Drupal\simpletest\WebTestBase.
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function assertHeader($header, $value, $message = '', $group = 'Browser') {
$header_value = $this
->drupalGetHeader($header);
return $this
->assertTrue($header_value == $value, $message ? $message : 'HTTP response header ' . $header . ' with value ' . $value . ' found, actual value: ' . $header_value, $group);
}