function ThemeTestCase::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

modules/simpletest/tests/theme.test, line 97

Class

ThemeTestCase
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.
    variable_set('preprocess_css', 0);
    $this->drupalGet('theme-test/suggestion');
    $this->assertNoText('system.base.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, simply ensuring no PHP errors are
    // triggered during drupal_build_css_cache() when a source file doesn't
    // exist. Then allow remaining tests to continue with aggregation disabled
    // by default.
    variable_set('preprocess_css', 1);
    $this->drupalGet('theme-test/suggestion');
    variable_set('preprocess_css', 0);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.