1 common.test CommonCascadingStylesheetsTestCase::testRenderOverride()

Test CSS override.

File

core/modules/simpletest/tests/common.test, line 881
Tests for common.inc functionality.

Class

CommonCascadingStylesheetsTestCase
Test the Backdrop CSS system.

Code

function testRenderOverride() {
  $system = backdrop_get_path('module', 'system');
  $simpletest = backdrop_get_path('module', 'simpletest');

  backdrop_add_css($system . '/css/system.css');
  backdrop_add_css($simpletest . '/tests/system.css');

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

  backdrop_static_reset('backdrop_add_css');
  backdrop_add_css($simpletest . '/tests/system.css');
  backdrop_add_css($system . '/css/system.css');

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