Skip to content

Commit 2fb1d3d

Browse files
committed
Fix unit tests
1 parent 22c971c commit 2fb1d3d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

tests/Asset/TagRendererTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ public function testRenderScriptTags()
3333
->willReturnCallback(function($path) {
3434
return 'http://localhost:8080'.$path;
3535
});
36-
$renderer = new TagRenderer($entrypointCollection, $packages, 'anonymous');
36+
$renderer = new TagRenderer($entrypointCollection, $packages, ['crossorigin'=>'anonymous']);
3737

3838
$output = $renderer->renderWebpackScriptTags('my_entry', 'custom_package');
3939
$this->assertContains(
40-
'<script src="http://localhost:8080/build/file1.js"></script>',
40+
'<script src="http://localhost:8080/build/file1.js" crossorigin="anonymous"></script>',
4141
$output
4242
);
4343
$this->assertContains(
44-
'<script src="http://localhost:8080/build/file2.js"></script>',
44+
'<script src="http://localhost:8080/build/file2.js" crossorigin="anonymous"></script>',
4545
$output
4646
);
4747
}
@@ -64,11 +64,11 @@ public function testRenderScriptTagsWithBadFilename()
6464
->willReturnCallback(function($path) {
6565
return 'http://localhost:8080'.$path;
6666
});
67-
$renderer = new TagRenderer($entrypointCollection, $packages, 'anonymous');
67+
$renderer = new TagRenderer($entrypointCollection, $packages, ['crossorigin'=>'anonymous']);
6868

6969
$output = $renderer->renderWebpackScriptTags('my_entry', 'custom_package');
7070
$this->assertContains(
71-
'<script src="http://localhost:8080/build/file&lt;&quot;bad_chars.js"></script>',
71+
'<script src="http://localhost:8080/build/file&lt;&quot;bad_chars.js" crossorigin="anonymous"></script>',
7272
$output
7373
);
7474
}
@@ -110,21 +110,21 @@ public function testRenderScriptTagsWithinAnEntryPointCollection()
110110
->willReturnCallback(function($path) {
111111
return 'http://localhost:8080'.$path;
112112
});
113-
$renderer = new TagRenderer($entrypointCollection, $packages, 'anonymous');
113+
$renderer = new TagRenderer($entrypointCollection, $packages, ['crossorigin'=>'anonymous']);
114114

115115
$output = $renderer->renderWebpackScriptTags('my_entry', 'custom_package');
116116
$this->assertContains(
117-
'<script src="http://localhost:8080/build/file1.js"></script>',
117+
'<script src="http://localhost:8080/build/file1.js" crossorigin="anonymous"></script>',
118118
$output
119119
);
120120
$output = $renderer->renderWebpackScriptTags('my_entry', null, 'second');
121121
$this->assertContains(
122-
'<script src="http://localhost:8080/build/file2.js"></script>',
122+
'<script src="http://localhost:8080/build/file2.js" crossorigin="anonymous"></script>',
123123
$output
124124
);
125125
$output = $renderer->renderWebpackScriptTags('my_entry', 'specific_package', 'third');
126126
$this->assertContains(
127-
'<script src="http://localhost:8080/build/file3.js"></script>',
127+
'<script src="http://localhost:8080/build/file3.js" crossorigin="anonymous"></script>',
128128
$output
129129
);
130130
}
@@ -160,7 +160,7 @@ public function testRenderScriptTagsWithHashes()
160160
->willReturnCallback(function ($path) {
161161
return 'http://localhost:8080' . $path;
162162
});
163-
$renderer = new TagRenderer($entrypointCollection, $packages, 'anonymous');
163+
$renderer = new TagRenderer($entrypointCollection, $packages, ['crossorigin'=>'anonymous']);
164164

165165
$output = $renderer->renderWebpackScriptTags('my_entry', 'custom_package');
166166
$this->assertContains(

tests/IntegrationTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function testTwigIntegration()
2424

2525
$html1 = $container->get('twig')->render('@integration_test/template.twig');
2626
$this->assertContains(
27-
'<script src="/build/file1.js" integrity="sha384-Q86c+opr0lBUPWN28BLJFqmLhho+9ZcJpXHorQvX6mYDWJ24RQcdDarXFQYN8HLc" crossorigin="anonymous"></script>',
27+
'<script src="/build/file1.js" integrity="sha384-Q86c+opr0lBUPWN28BLJFqmLhho+9ZcJpXHorQvX6mYDWJ24RQcdDarXFQYN8HLc"></script>',
2828
$html1
2929
);
3030
$this->assertContains(
31-
'<link rel="stylesheet" href="/build/styles.css" integrity="sha384-4g+Zv0iELStVvA4/B27g4TQHUMwZttA5TEojjUyB8Gl5p7sarU4y+VTSGMrNab8n" crossorigin="anonymous">' .
32-
'<link rel="stylesheet" href="/build/styles2.css" integrity="sha384-hfZmq9+2oI5Cst4/F4YyS2tJAAYdGz7vqSMP8cJoa8bVOr2kxNRLxSw6P8UZjwUn" crossorigin="anonymous">',
31+
'<link rel="stylesheet" href="/build/styles.css" integrity="sha384-4g+Zv0iELStVvA4/B27g4TQHUMwZttA5TEojjUyB8Gl5p7sarU4y+VTSGMrNab8n">' .
32+
'<link rel="stylesheet" href="/build/styles2.css" integrity="sha384-hfZmq9+2oI5Cst4/F4YyS2tJAAYdGz7vqSMP8cJoa8bVOr2kxNRLxSw6P8UZjwUn">',
3333
$html1
3434
);
3535
$this->assertContains(

0 commit comments

Comments
 (0)