Skip to content

Commit ea84ec6

Browse files
authored
[feature] Assert that an header is not present (#98)
1 parent f35ce6d commit ea84ec6

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ $browser
227227
->assertRedirected() // 3xx status code
228228
->assertHeaderEquals('Content-Type', 'text/html; charset=UTF-8')
229229
->assertHeaderContains('Content-Type', 'html')
230+
->assertHeaderEquals('X-Not-Present-Header', null)
230231

231232
// helpers for quickly checking the content type
232233
->assertJson()

src/Browser/KernelBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ final public function assertRedirected(): self
414414
/**
415415
* @return static
416416
*/
417-
final public function assertHeaderEquals(string $header, string $expected): self
417+
final public function assertHeaderEquals(string $header, ?string $expected): self
418418
{
419419
$this->session()->assert()->responseHeaderEquals($header, $expected);
420420

tests/KernelBrowserTests.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public function response_header_assertions(): void
233233
->visit('/page1')
234234
->assertHeaderEquals('Content-Type', 'text/html; charset=UTF-8')
235235
->assertHeaderContains('Content-Type', 'text/html')
236+
->assertHeaderEquals('X-Not-Present-Header', null)
236237
;
237238
}
238239

0 commit comments

Comments
 (0)