You are here

function CascadingStylesheetsTestCase::testRenderInlineFullPage in Drupal 7

Tests rendering inline stylesheets through a full page request.

File

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

Class

CascadingStylesheetsTestCase
Test the Drupal CSS system.

Code

function testRenderInlineFullPage() {
  $css = 'body { font-size: 254px; }';

  // Inline CSS is minified unless 'preprocess' => FALSE is passed as a
  // drupal_add_css() option.
  $expected = 'body{font-size:254px;}';

  // Create a node, using the PHP filter that tests drupal_add_css().
  $php_format_id = 'php_code';
  $settings = array(
    'type' => 'page',
    'body' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => t('This tests the inline CSS!') . "<?php drupal_add_css('{$css}', 'inline'); ?>",
          'format' => $php_format_id,
        ),
      ),
    ),
    'promote' => 1,
  );
  $node = $this
    ->drupalCreateNode($settings);

  // Fetch the page.
  $this
    ->drupalGet('node/' . $node->nid);
  $this
    ->assertRaw($expected, 'Inline stylesheets appear in the full page rendering.');
}