Skip to content

[WebProfilerBundle] Fix minify test after JS refactor #50849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ class MinifyTest extends TestCase
public function testNoSingleLineComments()
{
$dir = \dirname(__DIR__, 2).'/Resources/views/Profiler';
$message = 'There cannot be any single line comment in this file. Consider using multiple line comment. ';
$this->assertTrue(2 === substr_count(file_get_contents($dir.'/base_js.html.twig'), '//'), $message);
$this->assertTrue(0 === substr_count(file_get_contents($dir.'/toolbar.css.twig'), '//'), $message);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this CSS files ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this applies, // is not a valid CSS comment and CSS only supports the /* ... */ comment syntax.


foreach (glob($dir.'/*js.html.twig') as $jsFile) {
$fileContents = file_get_contents($dir.'/base_js.html.twig');
$fileContents = str_replace('\'//\'', '', $fileContents);

$this->assertEquals(0, substr_count($fileContents, '//'), 'There cannot be any single line comment in "'.$jsFile.'". Consider using multiple line comment. ');
}
}
}