You are here

function CascadingStylesheetsTestCase::testRenderOverride in SimpleTest 7

Test CSS override.

File

tests/common.test, line 609
Tests for common.inc functionality.

Class

CascadingStylesheetsTestCase
Test the Drupal CSS system.

Code

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

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

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