You are here

function CssOptimizerUnitTest::testTypeExternal in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php \Drupal\Tests\Core\Asset\CssOptimizerUnitTest::testTypeExternal()

Tests a CSS asset with 'type' => 'external'.

File

core/tests/Drupal/Tests/Core/Asset/CssOptimizerUnitTest.php, line 255
Contains \Drupal\Tests\Core\Asset\CssOptimizerUnitTest.

Class

CssOptimizerUnitTest
Tests the CSS asset optimizer.

Namespace

Drupal\Tests\Core\Asset

Code

function testTypeExternal() {
  $this
    ->setExpectedException('Exception', 'Only file or inline CSS assets can be optimized.');
  $css_asset = array(
    'group' => -100,
    // Type external.
    'type' => 'external',
    'weight' => 0.012,
    'media' => 'all',
    'preprocess' => TRUE,
    'data' => 'http://example.com/foo.js',
    'browsers' => array(
      'IE' => TRUE,
      '!IE' => TRUE,
    ),
  );
  $this->optimizer
    ->optimize($css_asset);
}