diff options
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/simpletest.module | 2 | ||||
-rw-r--r-- | modules/simpletest/simpletest.pages.inc | 31 | ||||
-rw-r--r-- | modules/simpletest/tests/common_test.module | 4 | ||||
-rw-r--r-- | modules/simpletest/tests/field_test.module | 8 | ||||
-rw-r--r-- | modules/simpletest/tests/theme.test | 4 |
5 files changed, 30 insertions, 19 deletions
diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index 234ecb89d..5a6cd411e 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -209,7 +209,7 @@ 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'] .= '<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', $items); + $context['message'] .= theme('item_list', array('items' => $items)); // Save working values for the next iteration. $context['sandbox']['tests'] = $test_list; diff --git a/modules/simpletest/simpletest.pages.inc b/modules/simpletest/simpletest.pages.inc index cb5ccfefc..5ba188f66 100644 --- a/modules/simpletest/simpletest.pages.inc +++ b/modules/simpletest/simpletest.pages.inc @@ -60,10 +60,16 @@ function simpletest_test_form($form) { /** * Theme the test list generated by simpletest_test_form() into a table. * - * @param $table Form array that represent a table. - * @return HTML output. + * @param $variables + * An associative array containing: + * - table: Form array that represent a table. + * + * @return + * HTML output. */ -function theme_simpletest_test_table($table) { +function theme_simpletest_test_table($variables) { + $table = $variables['table']; + drupal_add_css(drupal_get_path('module', 'simpletest') . '/simpletest.css'); drupal_add_js(drupal_get_path('module', 'simpletest') . '/simpletest.js'); @@ -77,8 +83,8 @@ function theme_simpletest_test_table($table) { // Define the images used to expand/collapse the test groups. $js = array( 'images' => array( - theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'), - theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'), + theme('image', array('path' => 'misc/menu-collapsed.png', 'alt' => 'Expand', 'title' => 'Expand')), + theme('image', array('path' => 'misc/menu-expanded.png', 'alt' => 'Collapsed', 'title' => 'Collapsed')), ), ); @@ -140,7 +146,7 @@ function theme_simpletest_test_table($table) { $test['#name'] = $test_name; $row[] = drupal_render($test); - $row[] = theme('indentation', 1) . '<label for="edit-' . $test_name . '">' . $title . '</label>'; + $row[] = theme('indentation', array('size' => 1)) . '<label for="edit-' . $test_name . '">' . $title . '</label>'; $row[] = '<div class="description">' . $description . '</div>'; $rows[] = array('data' => $row, 'class' => array($test_class . '-test', ($collapsed ? 'js-hide' : ''))); @@ -156,7 +162,7 @@ function theme_simpletest_test_table($table) { return '<strong>' . t('No tests to display.') . '</strong>'; } else { - return theme('table', $header, $rows, array('id' => 'simpletest-form-table')); + return theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'simpletest-form-table'))); } } @@ -358,7 +364,8 @@ function simpletest_result_form_submit($form, &$form_state) { * * @return HTML output. */ -function theme_simpletest_result_summary($form) { +function theme_simpletest_result_summary($variables) { + $form = $variables['form']; return '<div class="simpletest-' . ($form['#ok'] ? 'pass' : 'fail') . '">' . _simpletest_format_summary_line($form) . '</div>'; } @@ -398,10 +405,10 @@ function simpletest_result_status_image($status) { if (!isset($map)) { $map = array( - 'pass' => theme('image', 'misc/watchdog-ok.png', t('Pass')), - 'fail' => theme('image', 'misc/watchdog-error.png', t('Fail')), - 'exception' => theme('image', 'misc/watchdog-warning.png', t('Exception')), - 'debug' => theme('image', 'misc/watchdog-warning.png', t('Debug')), + 'pass' => theme('image', array('path' => 'misc/watchdog-ok.png', 'alt' => t('Pass'))), + 'fail' => theme('image', array('path' => 'misc/watchdog-error.png', 'alt' => t('Fail'))), + 'exception' => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('Exception'))), + 'debug' => theme('image', array('path' => 'misc/watchdog-warning.png', 'alt' => t('Debug'))), ); } if (isset($map[$status])) { diff --git a/modules/simpletest/tests/common_test.module b/modules/simpletest/tests/common_test.module index e94f72811..f7abf51b6 100644 --- a/modules/simpletest/tests/common_test.module +++ b/modules/simpletest/tests/common_test.module @@ -84,8 +84,8 @@ function common_test_theme() { /** * Theme function for testing drupal_render() theming. */ -function theme_common_test_foo($foo, $bar) { - return $foo . $bar; +function theme_common_test_foo($variables) { + return $variables['foo'] . $variables['bar']; } /** diff --git a/modules/simpletest/tests/field_test.module b/modules/simpletest/tests/field_test.module index 6d463daee..6bd73c250 100644 --- a/modules/simpletest/tests/field_test.module +++ b/modules/simpletest/tests/field_test.module @@ -570,7 +570,9 @@ function field_test_theme() { /** * Theme function for 'field_test_default' formatter. */ -function theme_field_formatter_field_test_default($element) { +function theme_field_formatter_field_test_default($variables) { + $element = $variables['element']; + $value = $element['#item']['value']; $settings = $element['#settings']; @@ -580,7 +582,9 @@ function theme_field_formatter_field_test_default($element) { /** * Theme function for 'field_test_multiple' formatter. */ -function theme_field_formatter_field_test_multiple($element) { +function theme_field_formatter_field_test_multiple($variables) { + $element = $variables['element']; + $settings = $element['#settings']; $items = array(); diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index 29fc445c7..56860bd13 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -70,7 +70,7 @@ class ThemeTableUnitTest extends DrupalWebTestCase { function testThemeTableStickyHeaders() { $header = array('one', 'two', 'three'); $rows = array(array(1,2,3), array(4,5,6), array(7,8,9)); - $this->content = theme('table', $header, $rows); + $this->content = theme('table', array('header' => $header, 'rows' => $rows)); $js = drupal_add_js(); $this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.')); $this->assertRaw('sticky-enabled', t('Table has a class of sticky-enabled when $sticky = TRUE.')); @@ -86,7 +86,7 @@ class ThemeTableUnitTest extends DrupalWebTestCase { $attributes = array(); $caption = NULL; $colgroups = array(); - $this->content = theme('table', $header, $rows, $attributes, $caption, $colgroups, FALSE); + $this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE)); $js = drupal_add_js(); $this->assertFalse(isset($js['misc/tableheader.js']), t('tableheader.js was not included because $sticky = FALSE.')); $this->assertNoRaw('sticky-enabled', t('Table does not have a class of sticky-enabled because $sticky = FALSE.')); |