You are here

function DrupalRenderUnitTestCase::testDrupalRenderThemeArguments in SimpleTest 7

Test passing arguments to the theme function.

File

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

Class

DrupalRenderUnitTestCase
Tests for drupal_render().

Code

function testDrupalRenderThemeArguments() {
  $element = array(
    '#theme' => 'common_test_foo',
  );

  // Test that defaults work.
  $this
    ->assertEqual(drupal_render($element), 'foobar', 'Defaults work');
  $element = array(
    '#theme' => 'common_test_foo',
    '#foo' => $this
      ->randomName(),
    '#bar' => $this
      ->randomName(),
  );

  // Test that passing arguments to the theme function works.
  $this
    ->assertEqual(drupal_render($element), $element['#foo'] . $element['#bar'], 'Passing arguments to theme functions works');
}