@@ -27,71 +27,77 @@ public function it_outputs_script()
2727 {
2828 $ output = $ this ->tag ('{{ vite src="test.js" }} ' );
2929
30- $ expected = <<<'HTML'
31- <link rel="modulepreload" href="http://localhost/build/assets/test-123.js" />
32- <script type="module" src="http://localhost/build/assets/test-123.js"></script>
33- HTML;
30+ $ this ->assertStringContainsString ('<link rel="modulepreload" ' , $ output );
31+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.js" /> ' , $ output );
3432
35- $ this ->assertEqualsIgnoringLineBreaks ($ expected , $ output );
33+ $ this ->assertStringContainsString ('<script type="module" ' , $ output );
34+ $ this ->assertStringContainsString ('src="http://localhost/build/assets/test-123.js"></script> ' , $ output );
3635 }
3736
3837 #[Test]
3938 public function it_outputs_stylesheet ()
4039 {
41-
4240 $ output = $ this ->tag ('{{ vite src="test.css" }} ' );
4341
44- $ expected = <<<'HTML'
45- <link rel="preload" as="style" href="http://localhost/build/assets/test-123.css" />
46- <link rel="stylesheet" href="http://localhost/build/assets/test-123.css" />
47- HTML;
42+ $ this ->assertStringContainsString ('<link rel="preload" ' , $ output );
43+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" /> ' , $ output );
4844
49- $ this ->assertEqualsIgnoringLineBreaks ($ expected , $ output );
45+ $ this ->assertStringContainsString ('<link rel="stylesheet" ' , $ output );
46+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" /> ' , $ output );
5047 }
5148
5249 #[Test]
5350 public function it_outputs_multiple_entry_points ()
5451 {
5552 $ output = $ this ->tag ('{{ vite src="test.js|test.css" }} ' );
5653
57- $ expected = <<<'HTML'
58- <link rel="preload" as="style" href="http://localhost/build/assets/test-123.css" />
59- <link rel="modulepreload" href="http://localhost/build/assets/test-123.js" />
60- <link rel="stylesheet" href="http://localhost/build/assets/test-123.css" />
61- <script type="module" src="http://localhost/build/assets/test-123.js"></script>
62- HTML;
54+ $ this ->assertStringContainsString ('<link rel="preload" ' , $ output );
55+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" /> ' , $ output );
56+
57+ $ this ->assertStringContainsString ('<link rel="modulepreload" ' , $ output );
58+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.js" /> ' , $ output );
6359
64- $ this ->assertEqualsIgnoringLineBreaks ($ expected , $ output );
60+ $ this ->assertStringContainsString ('<link rel="stylesheet" ' , $ output );
61+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" /> ' , $ output );
62+
63+ $ this ->assertStringContainsString ('<script type="module" ' , $ output );
64+ $ this ->assertStringContainsString ('src="http://localhost/build/assets/test-123.js"></script> ' , $ output );
6565 }
6666
6767 #[Test]
6868 public function it_includes_attributes ()
6969 {
7070 $ output = $ this ->tag ('{{ vite src="test.js|test.css" alfa="bravo" attr:charlie="delta" }} ' );
7171
72- $ expected = <<<'HTML'
73- <link rel="preload" as="style" href="http://localhost/build/assets/test-123.css" />
74- <link rel="modulepreload" href="http://localhost/build/assets/test-123.js" />
75- <link rel="stylesheet" href="http://localhost/build/assets/test-123.css" charlie="delta" />
76- <script type="module" src="http://localhost/build/assets/test-123.js" charlie="delta"></script>
77- HTML;
72+ $ this ->assertStringContainsString ('<link rel="preload" as="style" ' , $ output );
73+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" /> ' , $ output );
74+
75+ $ this ->assertStringContainsString ('<link rel="modulepreload" ' , $ output );
76+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.js" /> ' , $ output );
7877
79- $ this ->assertEqualsIgnoringLineBreaks ($ expected , $ output );
78+ $ this ->assertStringContainsString ('<link rel="stylesheet" ' , $ output );
79+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" charlie="delta" /> ' , $ output );
80+
81+ $ this ->assertStringContainsString ('<script type="module" ' , $ output );
82+ $ this ->assertStringContainsString ('src="http://localhost/build/assets/test-123.js" charlie="delta"></script> ' , $ output );
8083 }
8184
8285 #[Test]
8386 public function it_includes_tag_specific_attributes ()
8487 {
8588 $ output = $ this ->tag ('{{ vite src="test.js|test.css" alfa="bravo" attr:charlie="delta" attr:script:echo="foxtrot" attr:style:golf="hotel" }} ' );
8689
87- $ expected = <<<'HTML'
88- <link rel="preload" as="style" href="http://localhost/build/assets/test-123.css" />
89- <link rel="modulepreload" href="http://localhost/build/assets/test-123.js" />
90- <link rel="stylesheet" href="http://localhost/build/assets/test-123.css" charlie="delta" golf="hotel" />
91- <script type="module" src="http://localhost/build/assets/test-123.js" charlie="delta" echo="foxtrot"></script>
92- HTML;
90+ $ this ->assertStringContainsString ('<link rel="preload" as="style" ' , $ output );
91+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" /> ' , $ output );
92+
93+ $ this ->assertStringContainsString ('<link rel="modulepreload" ' , $ output );
94+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.js" /> ' , $ output );
95+
96+ $ this ->assertStringContainsString ('<link rel="stylesheet" ' , $ output );
97+ $ this ->assertStringContainsString ('href="http://localhost/build/assets/test-123.css" charlie="delta" golf="hotel" /> ' , $ output );
9398
94- $ this ->assertEqualsIgnoringLineBreaks ($ expected , $ output );
99+ $ this ->assertStringContainsString ('<script type="module" ' , $ output );
100+ $ this ->assertStringContainsString ('src="http://localhost/build/assets/test-123.js" charlie="delta" echo="foxtrot"></script> ' , $ output );
95101 }
96102
97103 // Ignore line breaks just for the sake of readability in the test.
0 commit comments