You are here

function CascadingStylesheetsTestCase::testRenderInlineFullPage in SimpleTest 7

Tests rendering inline stylesheets through a full page request.

File

tests/common.test, line 548
Tests for common.inc functionality.

Class

CascadingStylesheetsTestCase
Test the Drupal CSS system.

Code

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

  // Create a node, using the PHP filter that tests drupal_add_css().
  $settings = array(
    'type' => 'page',
    'body' => array(
      FIELD_LANGUAGE_NONE => array(
        array(
          'value' => t('This tests the inline CSS!') . "<?php drupal_add_css('{$css}', 'inline'); ?>",
          // The "PHP code" format is always the most recent one added, since
          // the PHP module was enabled in the setUp() method of the current
          // test.
          'format' => db_query("SELECT MAX(format) FROM {filter_format}")
            ->fetchField(),
        ),
      ),
    ),
    'promote' => 1,
  );
  $node = $this
    ->drupalCreateNode($settings);

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