function WebAssert::responseHeaderDoesNotExist

Same name in other branches
  1. 9 core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::responseHeaderDoesNotExist()
  2. 11.x core/tests/Drupal/Tests/WebAssert.php \Drupal\Tests\WebAssert::responseHeaderDoesNotExist()

Asserts that the current response header does not have a specific entry.

Parameters

string $name: The name of the header entry to check existence of.

string $message: The failure message.

1 call to WebAssert::responseHeaderDoesNotExist()
WebAssert::responseHeaderEquals in core/tests/Drupal/Tests/WebAssert.php

File

core/tests/Drupal/Tests/WebAssert.php, line 103

Class

WebAssert
Defines a class with methods for asserting presence of elements during tests.

Namespace

Drupal\Tests

Code

public function responseHeaderDoesNotExist(string $name, string $message = '') : void {
    if ($message === '') {
        $message = "Failed asserting that the response does not have a '{$name}' header.";
    }
    $headers = $this->session
        ->getResponseHeaders();
    $constraint = new LogicalNot(new ArrayHasKey($name));
    Assert::assertThat($headers, $constraint, $message);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.