Commit cc1f3fde authored by alexpott's avatar alexpott
Browse files

Issue #2009670 followup by Eric_A: Fixed Replace theme() with drupal_render() in simpletest module.

parent 7bdc1e61
......@@ -2744,11 +2744,7 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') {
* TRUE on pass, FALSE on fail.
*/
protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
$build = array('#theme' => $callback);
foreach($variables as $key => $variable) {
$build["#$key"] = $variable;
}
$output = drupal_render($build);
$output = theme($callback, $variables);
$this->verbose('Variables:' . '<pre>' . check_plain(var_export($variables, TRUE)) . '</pre>'
. '<hr />' . 'Result:' . '<pre>' . check_plain(var_export($output, TRUE)) . '</pre>'
. '<hr />' . 'Expected:' . '<pre>' . check_plain(var_export($expected, TRUE)) . '</pre>'
......
......@@ -46,15 +46,15 @@ function setUp() {
* - any attributes set in the template's preprocessing function
*/
function testAttributeMerging() {
$output = theme('theme_test_render_element', array(
$theme_test_render_element = array(
'elements' => array(
'#attributes' => array('data-foo' => 'bar'),
),
'attributes' => array(
'id' => 'bazinga',
),
));
$this->assertIdentical($output, '<div id="bazinga" data-foo="bar" data-variables-are-preprocessed></div>' . "\n");
);
$this->assertThemeOutput('theme_test_render_element', $theme_test_render_element, '<div id="bazinga" data-foo="bar" data-variables-are-preprocessed></div>' . "\n");
}
/**
......@@ -222,7 +222,7 @@ function testThemeGetSetting() {
* Ensures the theme registry is rebuilt when modules are disabled/enabled.
*/
function testRegistryRebuild() {
$this->assertIdentical(theme('theme_test_foo', array('foo' => 'a')), 'a', 'The theme registry contains theme_test_foo.');
$this->assertThemeOutput('theme_test_foo', array('foo' => 'a'), 'a', 'The theme registry contains theme_test_foo.');
module_disable(array('theme_test'), FALSE);
// After enabling/disabling a module during a test, we need to rebuild the
......@@ -230,7 +230,7 @@ function testRegistryRebuild() {
// throws an exception.
$this->rebuildContainer();
$this->container->get('module_handler')->loadAll();
$this->assertIdentical(theme('theme_test_foo', array('foo' => 'b')), FALSE, 'The theme registry does not contain theme_test_foo, because the module is disabled.');
$this->assertThemeOutput('theme_test_foo', array('foo' => 'b'), FALSE, 'The theme registry does not contain theme_test_foo, because the module is disabled.');
module_enable(array('theme_test'), FALSE);
// After enabling/disabling a module during a test, we need to rebuild the
......@@ -238,7 +238,7 @@ function testRegistryRebuild() {
// throws an exception.
$this->rebuildContainer();
$this->container->get('module_handler')->loadAll();
$this->assertIdentical(theme('theme_test_foo', array('foo' => 'c')), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.');
$this->assertThemeOutput('theme_test_foo', array('foo' => 'c'), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.');
}
/**
......@@ -251,7 +251,7 @@ function testDrupalRenderChildren() {
'#markup' => 'Foo',
),
);
$this->assertIdentical(theme('theme_test_render_element_children', $element), 'Foo', 'drupal_render() avoids #theme recursion loop when rendering a render element.');
$this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', 'drupal_render() avoids #theme recursion loop when rendering a render element.');
$element = array(
'#theme_wrappers' => array('theme_test_render_element_children'),
......@@ -259,7 +259,7 @@ function testDrupalRenderChildren() {
'#markup' => 'Foo',
),
);
$this->assertIdentical(theme('theme_test_render_element_children', $element), 'Foo', 'drupal_render() avoids #theme_wrappers recursion loop when rendering a render element.');
$this->assertThemeOutput('theme_test_render_element_children', $element, 'Foo', 'drupal_render() avoids #theme_wrappers recursion loop when rendering a render element.');
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment