You are here

function CascadingStylesheetsTestCase::testRenderFile in Drupal 7

Tests rendering the stylesheets.

File

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

Class

CascadingStylesheetsTestCase
Test the Drupal CSS system.

Code

function testRenderFile() {
  $css = drupal_get_path('module', 'simpletest') . '/simpletest.css';
  drupal_add_css($css);
  $styles = drupal_get_css();
  $this
    ->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.');

  // Verify that newlines are properly added inside style tags.
  $query_string = variable_get('css_js_query_string', '0');
  $css_processed = "<style type=\"text/css\" media=\"all\">\n@import url(\"" . check_plain(file_create_url($css)) . "?" . $query_string . "\");\n</style>";
  $this
    ->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.');
}