function CascadingStylesheetsTest::testRenderOverride

Tests CSS override.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php, line 186
Definition of Drupal\system\Tests\Common\CascadingStylesheetsTest.

Class

CascadingStylesheetsTest
Tests the Drupal CSS system.

Namespace

Drupal\system\Tests\Common

Code

function testRenderOverride() {
  $system = drupal_get_path('module', 'system');
  drupal_add_css($system . '/css/system.module.css');
  drupal_add_css($system . '/tests/css/system.module.css');

  // The dummy stylesheet should be the only one included.
  $styles = drupal_get_css();
  $this
    ->assert(strpos($styles, $system . '/tests/css/system.module.css') !== FALSE, 'The overriding CSS file is output.');
  $this
    ->assert(strpos($styles, $system . '/css/system.module.css') === FALSE, 'The overridden CSS file is not output.');
  drupal_add_css($system . '/tests/css/system.module.css');
  drupal_add_css($system . '/css/system.module.css');

  // The standard stylesheet should be the only one included.
  $styles = drupal_get_css();
  $this
    ->assert(strpos($styles, $system . '/css/system.module.css') !== FALSE, 'The overriding CSS file is output.');
  $this
    ->assert(strpos($styles, $system . '/tests/css/system.module.css') === FALSE, 'The overridden CSS file is not output.');
}