You are here

public function WebAssert::responseHeaderDoesNotExist in Drupal 10

Same name and namespace in other branches
  1. 9 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.

File

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

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);
}