1 theme.test ThemeUnitTest::testCSSOverride()

Ensures a theme's .info file is able to override a module CSS file from being added to the page.

See also

test_theme.info

File

core/modules/simpletest/tests/theme.test, line 89
Tests for the theme API.

Class

ThemeUnitTest
Unit tests for the Theme API.

Code

function testCSSOverride() {
  // Reuse the same page as in testPreprocessForSuggestions(). We're testing
  // what is output to the HTML HEAD based on what is in a theme's .info file,
  // so it doesn't matter what page we get, as long as it is themed with the
  // test theme. First we test with CSS aggregation disabled.
  config_set('system.core', 'preprocess_css', 0);
  $this->backdropGet('theme-test/suggestion');
  $this->assertNoText('modules/system/css/system.css', "The theme's .info file is able to override a module CSS file from being added to the page.");

  // Also test with aggregation enabled, ensuring no PHP errors are triggered
  // during backdrop_build_css_cache() when a source file doesn't exist. Then
  // allow remaining tests to continue with aggregation disabled by default.
  config_set('system.core', 'preprocess_css', 1);
  $this->backdropGet('theme-test/suggestion');
  config_set('system.core', 'preprocess_css', 0);
}