function CssOptimizerUnitTest::testTypeFilePreprocessingDisabled

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testTypeFilePreprocessingDisabled()
  2. 10 core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testTypeFilePreprocessingDisabled()
  3. 11.x 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 249

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',
        'browsers' => [
            'IE' => TRUE,
            '!IE' => TRUE,
        ],
        'basename' => 'foo.css',
    ];
    $this->optimizer
        ->optimize($css_asset);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.