You are here

function CascadingStylesheetsTestCase::testModuleInfo in Drupal 7

Test that stylesheets in module .info files are loaded.

File

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

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.");
}