You are here

public function CssOptimizerUnitTest::testTypeFilePreprocessingDisabled in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testTypeFilePreprocessingDisabled()
  2. 9 core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testTypeFilePreprocessingDisabled()

Tests a file CSS asset with preprocessing disabled.

File

core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php, line 248

Class

CssOptimizerUnitTest
Tests the CSS asset optimizer.

Namespace

Drupal\Tests\Core\Asset

Code

public function testTypeFilePreprocessingDisabled() {
  $this
    ->expectException('Exception');
  $this
    ->expectExceptionMessage('Only file CSS assets with preprocessing enabled can be optimized.');
  $css_asset = [
    'group' => -100,
    'type' => 'file',
    'weight' => 0.012,
    'media' => 'all',
    // Preprocessing disabled.
    'preprocess' => FALSE,
    'data' => 'tests/Drupal/Tests/Core/Asset/foo.css',
    'basename' => 'foo.css',
  ];
  $this->optimizer
    ->optimize($css_asset);
}