diff --git a/README.md b/README.md index ef72488..754214b 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,7 @@ $browser ->assertRedirected() // 3xx status code ->assertHeaderEquals('Content-Type', 'text/html; charset=UTF-8') ->assertHeaderContains('Content-Type', 'html') + ->assertHeaderEquals('X-Not-Present-Header', null) // helpers for quickly checking the content type ->assertJson() diff --git a/src/Browser/KernelBrowser.php b/src/Browser/KernelBrowser.php index 120810f..69c487c 100644 --- a/src/Browser/KernelBrowser.php +++ b/src/Browser/KernelBrowser.php @@ -414,7 +414,7 @@ final public function assertRedirected(): self /** * @return static */ - final public function assertHeaderEquals(string $header, string $expected): self + final public function assertHeaderEquals(string $header, ?string $expected): self { $this->session()->assert()->responseHeaderEquals($header, $expected); diff --git a/tests/KernelBrowserTests.php b/tests/KernelBrowserTests.php index 610c94a..24c70be 100644 --- a/tests/KernelBrowserTests.php +++ b/tests/KernelBrowserTests.php @@ -233,6 +233,7 @@ public function response_header_assertions(): void ->visit('/page1') ->assertHeaderEquals('Content-Type', 'text/html; charset=UTF-8') ->assertHeaderContains('Content-Type', 'text/html') + ->assertHeaderEquals('X-Not-Present-Header', null) ; }