Commit b7f29c4c authored by alexpott's avatar alexpott
Browse files

Issue #2009670 by esunger, jeroen12345, hussainweb: Replace theme() with...

Issue #2009670 by esunger, jeroen12345, hussainweb: Replace theme() with drupal_render() in simpletest module.
parent c250f735
...@@ -48,31 +48,39 @@ public static function create(ContainerInterface $container) { ...@@ -48,31 +48,39 @@ public static function create(ContainerInterface $container) {
public function __construct(Connection $database) { public function __construct(Connection $database) {
$this->database = $database; $this->database = $database;
// Initialize image mapping property. // Initialize image mapping property.
$image_pass = array(
'#theme' => 'image',
'#uri' => 'core/misc/watchdog-ok.png',
'#width' => 18,
'#height' => 18,
'#alt' => t('Pass'),
);
$image_fail = array(
'#theme' => 'image',
'#uri' => 'core/misc/watchdog-error.png',
'#width' => 18,
'#height' => 18,
'#alt' => t('Fail'),
);
$image_exception = array(
'#theme' => 'image',
'#uri' => 'core/misc/watchdog-warning.png',
'#width' => 18,
'#height' => 18,
'#alt' => t('Exception'),
);
$image_debug = array(
'#theme' => 'image',
'#uri' => 'core/misc/watchdog-warning.png',
'#width' => 18,
'#height' => 18,
'#alt' => t('Debug'),
);
$this->statusImageMap = array( $this->statusImageMap = array(
'pass' => theme('image', array( 'pass' => drupal_render($image_pass),
'uri' => 'core/misc/watchdog-ok.png', 'fail' => drupal_render($image_fail),
'width' => 18, 'exception' => drupal_render($image_exception),
'height' => 18, 'debug' => drupal_render($image_debug),
'alt' => t('Pass')
)),
'fail' => theme('image', array(
'uri' => 'core/misc/watchdog-error.png',
'width' => 18,
'height' => 18,
'alt' => t('Fail')
)),
'exception' => theme('image', array(
'uri' => 'core/misc/watchdog-warning.png',
'width' => 18,
'height' => 18,
'alt' => t('Exception')
)),
'debug' => theme('image', array(
'uri' => 'core/misc/watchdog-warning.png',
'width' => 18,
'height' => 18,
'alt' => t('Debug')
)),
); );
} }
......
...@@ -2627,7 +2627,11 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') { ...@@ -2627,7 +2627,11 @@ protected function assertNoTitle($title, $message = '', $group = 'Other') {
* TRUE on pass, FALSE on fail. * TRUE on pass, FALSE on fail.
*/ */
protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') { protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
$output = theme($callback, $variables); $build = array('#theme' => $callback);
foreach($variables as $key => $variable) {
$build["#$key"] = $variable;
}
$output = drupal_render($build);
$this->verbose('Variables:' . '<pre>' . check_plain(var_export($variables, TRUE)) . '</pre>' $this->verbose('Variables:' . '<pre>' . check_plain(var_export($variables, TRUE)) . '</pre>'
. '<hr />' . 'Result:' . '<pre>' . check_plain(var_export($output, TRUE)) . '</pre>' . '<hr />' . 'Result:' . '<pre>' . check_plain(var_export($output, TRUE)) . '</pre>'
. '<hr />' . 'Expected:' . '<pre>' . check_plain(var_export($expected, TRUE)) . '</pre>' . '<hr />' . 'Expected:' . '<pre>' . check_plain(var_export($expected, TRUE)) . '</pre>'
......
...@@ -319,7 +319,11 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) { ...@@ -319,7 +319,11 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) {
} }
$context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max)); $context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max));
$context['message'] .= '<div class="simpletest-' . ($test_results['#fail'] + $test_results['#exception'] ? 'fail' : 'pass') . '">Overall results: ' . _simpletest_format_summary_line($test_results) . '</div>'; $context['message'] .= '<div class="simpletest-' . ($test_results['#fail'] + $test_results['#exception'] ? 'fail' : 'pass') . '">Overall results: ' . _simpletest_format_summary_line($test_results) . '</div>';
$context['message'] .= theme('item_list', array('items' => $items)); $item_list = array(
'#theme' => 'item_list',
'#items' => $items,
);
$context['message'] .= drupal_render($item_list);
// Save working values for the next iteration. // Save working values for the next iteration.
$context['sandbox']['tests'] = $test_list; $context['sandbox']['tests'] = $test_list;
......
...@@ -27,10 +27,28 @@ function theme_simpletest_test_table($variables) { ...@@ -27,10 +27,28 @@ function theme_simpletest_test_table($variables) {
); );
// Define the images used to expand/collapse the test groups. // Define the images used to expand/collapse the test groups.
$image_collapsed = array(
'#theme' => 'image',
'#uri' => 'core/misc/menu-collapsed.png',
'#width' => '7',
'#height' => '7',
'#alt' => t('Expand'),
'#title' => t('Expand'),
'#suffix' => '<a href="#" class="simpletest-collapse">(' . t('Expand') . ')</a>',
);
$image_extended = array(
'#theme' => 'image',
'#uri' => 'core/misc/menu-expanded.png',
'#width' => '7',
'#height' => '7',
'#alt' => t('Collapse'),
'#title' => t('Collapse'),
'#suffix' => ' <a href="#" class="simpletest-collapse">(' . t('Collapse') . ')</a>',
);
$js = array( $js = array(
'images' => array( 'images' => array(
theme('image', array('uri' => 'core/misc/menu-collapsed.png', 'width' => 7, 'height' => 7, 'alt' => t('Expand'), 'title' => t('Expand'))) . ' <a href="#" class="simpletest-collapse">(' . t('Expand') . ')</a>', drupal_render($image_collapsed),
theme('image', array('uri' => 'core/misc/menu-expanded.png', 'width' => 7, 'height' => 7, 'alt' => t('Collapse'), 'title' => t('Collapse'))) . ' <a href="#" class="simpletest-collapse">(' . t('Collapse') . ')</a>', drupal_render($image_extended),
), ),
); );
...@@ -120,7 +138,13 @@ function theme_simpletest_test_table($variables) { ...@@ -120,7 +138,13 @@ function theme_simpletest_test_table($variables) {
return '<strong>' . t('No tests to display.') . '</strong>'; return '<strong>' . t('No tests to display.') . '</strong>';
} }
else { else {
return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'simpletest-form-table'))); $simpletest_form_table = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#attributes' => array('id' => 'simpletest-form-table'),
);
return drupal_render($simpletest_form_table);
} }
} }
......
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