Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function DrupalRenderTestCase::testDrupalRenderThemeArguments

Test passing arguments to the theme function.

File

modules/simpletest/tests/common.test, line 2268

Class

DrupalRenderTestCase
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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.