function CascadingStylesheetsTest::testRenderFile

Tests rendering the stylesheets.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php, line 75
Definition of Drupal\system\Tests\Common\CascadingStylesheetsTest.

Class

CascadingStylesheetsTest
Tests the Drupal CSS system.

Namespace

Drupal\system\Tests\Common

Code

function testRenderFile() {
  $css = drupal_get_path('module', 'simpletest') . '/css/simpletest.module.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 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.');
}