8000 minor #50849 [WebProfilerBundle] Fix minify test after JS refactor (w… · symfony/symfony@03e4b87 · GitHub
[go: up one dir, main page]

Skip to content

Commit 03e4b87

Browse files
minor #50849 [WebProfilerBundle] Fix minify test after JS refactor (wouterj)
This PR was merged into the 6.4 branch. Discussion ---------- [WebProfilerBundle] Fix minify test after JS refactor | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This test makes sure the JS files are valid after we "minify" them by removing newlines. After the refactor of #50790, it was not updated correctly causing a red CI. This fixes the test, and makes it more future proof. Commits ------- 3caa17a [WebProfilerBundle] Improve minify test after JS refactor
2 parents 3e172b3 + 3caa17a commit 03e4b87

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Symfony/Bundle/WebProfilerBundle/Tests/Resources/MinifyTest.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ class MinifyTest extends TestCase
2323
public function testNoSingleLineComments()
2424
{
2525
$dir = \dirname(__DIR__, 2).'/Resources/views/Profiler';
26-
$message = 'There cannot be any single line comment in this file. Consider using multiple line comment. ';
27-
$this->assertTrue(2 === substr_count(file_get_contents($dir.'/base_js.html.twig'), '//'), $message);
28-
$this->assertTrue(0 === substr_count(file_get_contents($dir.'/toolbar.css.twig'), '//'), $message);
26+
27+
foreach (glob($dir.'/*js.html.twig') as $jsFile) {
28+
$fileContents = file_get_contents($dir.'/base_js.html.twig');
29+
$fileContents = str_replace('\'//\'', '', $fileContents);
30+
31+
$this->assertEquals(0, substr_count($fileContents, '//'), 'There cannot be any single line comment in "'.$jsFile.'". Consider using multiple line comment. ');
32+
}
2933
}
3034
}

0 commit comments

Comments
 (0)
0