function RenderTest::testDrupalRenderThemeArguments

Tests passing arguments to the theme function.

File

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

Class

RenderTest
Tests drupal_render().

Namespace

Drupal\system\Tests\Common

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(),
  );

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