Skip to content

Commit

Permalink
[feature] Assert that an header is not present (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
nitneuk authored Aug 8, 2022
1 parent f35ce6d commit ea84ec6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Browser/KernelBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions tests/KernelBrowserTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
;
}

Expand Down

0 comments on commit ea84ec6

Please sign in to comment.