@@ -27,13 +27,14 @@ public function testHowInjectingSkipFilesExceptIndex()
2727 public function testHowInjectingWorksWithStandardCase ()
2828 {
2929 $ results = $ this ->newInjectHandle ('tests_inject_head ' , '/vue/index.html ' );
30- $ this ->assertInject ($ results );
30+ $ this ->assertStringContainsString ('/__config.js ' , $ results ->getContent ());
31+ $ this ->assertStringContainsString ('preload ' , $ results ->getContent ());
3132 }
3233
3334 public function testHowInjectingWorksWithoutHeadSection ()
3435 {
3536 $ results = $ this ->newInjectHandle ('tests_inject_head ' );
36- $ this ->assertInject ( $ results );
37+ $ this ->assertStringContainsString ( ' /__config.js ' , $ results-> getContent () );
3738 }
3839
3940 public function testHowInjectingWorksWithInvalidValue ()
@@ -46,12 +47,23 @@ public function testHowInjectingWorksWithEmptyHeadSection()
4647 {
4748 $ results = $ this ->newInjectHandle ('tests_inject_head ' , '/empty_index/index.html ' );
4849 $ this ->assertStringNotContainsString ('__config ' , $ results ->getContent ());
50+ $ this ->assertStringNotContainsString ('preload ' , $ results ->getContent ());
4951 }
5052
5153 public function testHowInjectingWorksWithoutScriptTag ()
5254 {
5355 $ results = $ this ->newInjectHandle ('tests ' , '/empty_index/index.html ' );
5456 $ this ->assertStringNotContainsString ('__config ' , $ results ->getContent ());
57+ $ this ->assertStringNotContainsString ('preload ' , $ results ->getContent ());
58+ }
59+
60+ public function testHowInjectingPreloading ()
61+ {
62+ $ results = $ this ->newInjectHandle ('tests ' , '/head_link_exists/index.html ' );
63+ $ this ->assertStringContainsString ('preload ' , $ results ->getContent ());
64+
65+ $ results = $ this ->newInjectHandle ('tests ' , '/head_link_not_exists/index.html ' );
66+ $ this ->assertStringContainsString ('preload ' , $ results ->getContent ());
5567 }
5668
5769 /**
@@ -72,9 +84,4 @@ private function newInjectHandle(string $config, string $location = '/empty_head
7284
7385 return $ handler ($ transfer , $ transfer );
7486 }
75-
76- private function assertInject (Transfer $ transfer )
77- {
78- $ this ->assertStringContainsString ('/__config.js ' , $ transfer ->getContent ());
79- }
8087}
0 commit comments