function CssOptimizerUnitTest::testOptimize
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testOptimize()
- 10 core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testOptimize()
- 11.x core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testOptimize()
Tests optimizing a CSS asset group containing 'type' => 'file'.
@dataProvider providerTestOptimize
File
-
core/
tests/ Drupal/ Tests/ Core/ Asset/ CssOptimizerUnitTest.php, line 231
Class
- CssOptimizerUnitTest
- Tests the CSS asset optimizer.
Namespace
Drupal\Tests\Core\AssetCode
public function testOptimize($css_asset, $expected) {
global $base_path;
$original_base_path = $base_path;
$base_path = '/';
// \Drupal\Core\Asset\CssOptimizer::loadFile() relies on the current working
// directory being the one that is used when index.php is the entry point.
// Note: PHPUnit automatically restores the original working directory.
chdir(realpath(__DIR__ . '/../../../../../../'));
$this->assertEquals($expected, $this->optimizer
->optimize($css_asset), 'Group of file CSS assets optimized correctly.');
$base_path = $original_base_path;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.