function CascadingStylesheetsTestCase::testModuleInfo

Test that stylesheets in module .info files are loaded.

File

modules/simpletest/tests/common.test, line 773

Class

CascadingStylesheetsTestCase
Test the Drupal CSS system.

Code

function testModuleInfo() {
    $this->drupalGet('');
    // Verify common_test.css in a STYLE media="all" tag.
    $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array(
        ':media' => 'all',
        ':filename' => 'tests/common_test.css',
    ));
    $this->assertTrue(count($elements), "Stylesheet with media 'all' in module .info file found.");
    // Verify common_test.print.css in a STYLE media="print" tag.
    $elements = $this->xpath('//style[@media=:media and contains(text(), :filename)]', array(
        ':media' => 'print',
        ':filename' => 'tests/common_test.print.css',
    ));
    $this->assertTrue(count($elements), "Stylesheet with media 'print' in module .info file found.");
}

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