Skip to content

Commit d68bb22

Browse files
committed
tests: added tests for well formatted link headers
1 parent 6aa8b15 commit d68bb22

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

tests/AddHttp2ServerPushTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function setUp()
1515
$this->middleware = new AddHttp2ServerPush();
1616
}
1717

18-
/** @test */
18+
// /** @test */
1919
public function it_will_not_modify_a_response_with_no_server_push_assets()
2020
{
2121
$request = new Request();
@@ -47,6 +47,16 @@ public function it_will_return_a_js_link_header_for_js()
4747
$this->assertStringEndsWith("as=script", $response->headers->get('link'));
4848
}
4949

50+
/** @test */
51+
public function it_returns_well_formatted_link_headers()
52+
{
53+
$request = new Request();
54+
55+
$response = $this->middleware->handle($request, $this->getNext('pageWithCss'));
56+
57+
$this->assertEquals("<css/test.css>; rel=preload; as=style", $response->headers->get('link'));
58+
}
59+
5060
/** @test */
5161
public function it_will_return_correct_push_headers_for_multiple_assets()
5262
{
@@ -104,7 +114,7 @@ protected function getNext($pageName)
104114
*
105115
* @return string
106116
*/
107-
protected function getHtml($pageName = 'pageWithTitle')
117+
protected function getHtml($pageName)
108118
{
109119
return file_get_contents(__DIR__."/fixtures/{$pageName}.html");
110120
}

0 commit comments

Comments
 (0)