function CssCollectionOptimizerLazyUnitTest::testExternalMinifiedCssAssetOptimizationIsSkipped
Test that external minified CSS assets do not trigger optimization.
This ensures that fully external asset groups do not result in a CssOptimizer exception and are safely ignored.
File
-
core/
tests/ Drupal/ Tests/ Core/ Asset/ CssCollectionOptimizerLazyUnitTest.php, line 157
Class
- CssCollectionOptimizerLazyUnitTest
- Tests the CSS asset optimizer.
Namespace
Drupal\Tests\Core\AssetCode
public function testExternalMinifiedCssAssetOptimizationIsSkipped() : void {
$mock_grouper = $this->createMock(AssetCollectionGrouperInterface::class);
$mock_optimizer = $this->createMock(AssetOptimizerInterface::class);
$mock_optimizer->expects($this->never())
->method('optimize');
$optimizer = new CssCollectionOptimizerLazy($mock_grouper, $mock_optimizer, $this->createMock(ThemeManagerInterface::class), $this->createMock(LibraryDependencyResolverInterface::class), new RequestStack(), $this->createMock(FileSystemInterface::class), $this->createMock(ConfigFactoryInterface::class), $this->createMock(FileUrlGeneratorInterface::class), $this->createMock(TimeInterface::class), $this->createMock(LanguageManagerInterface::class));
$optimizer->optimizeGroup([
'items' => [
[
'type' => 'external',
'data' => __DIR__ . '/css_test_files/css_external.optimized.aggregated.css',
'license' => FALSE,
'preprocess' => TRUE,
'minified' => TRUE,
],
],
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.