function CascadingStylesheetsTestCase::testRenderInlineFullPage

7.x common.test CascadingStylesheetsTestCase::testRenderInlineFullPage()

Tests rendering inline stylesheets through a full page request.

File

drupal-7.x/modules/simpletest/tests/common.test, line 727
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.');
}