diff --git a/includes/batch.inc b/includes/batch.inc index d9d5b2a9807..fb13aa58c8f 100644 --- a/includes/batch.inc +++ b/includes/batch.inc @@ -255,8 +255,11 @@ function _batch_process() { '@total' => $total, '@current' => floor($current), '@percentage' => $percentage, - ); - $message = strtr($progress_message, $values) . '
'; + ); + $message = strtr($progress_message, $values); + if (!empty($message)) { + $message .= '
'; + } $message .= $task_message ? $task_message : ' '; return array($percentage, $message); diff --git a/modules/simpletest/simpletest.css b/modules/simpletest/simpletest.css index b0e65e60eb6..1b4564c05ba 100644 --- a/modules/simpletest/simpletest.css +++ b/modules/simpletest/simpletest.css @@ -3,30 +3,36 @@ /* Addon for the simpletest module */ #simpletest { } + /* Test Table */ #simpletest-form-table th.select-all { width: 50px; } + th.simpletest_test { width: 160px; } table#simpletest-form-table tr td { - background-color: white !important; + background-color: white; color: #494949; } table#simpletest-form-table tr.simpletest-group td { - background-color: #EDF5FA !important; + background-color: #EDF5FA; color: #494949; } +div.message > div.item-list { + font-weight: normal; +} + div.simpletest-pass { color: #33a333; } -div.simpletest-fail { - color: #a30000; +.simpletest-fail { + color: #981010; } tr.simpletest-pass.odd { diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index bc51a68996c..896b64f6115 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -214,16 +214,16 @@ function theme_simpletest_test_table($table) { // Create header for test selection table. $header = array( - theme('table_select_header_cell'), - array('data' => t('Test'), 'class' => 'simpletest_test'), - array('data' => t('Description'), 'class' => 'simpletest_description'), + theme('table_select_header_cell'), + array('data' => t('Test'), 'class' => 'simpletest_test'), + array('data' => t('Description'), 'class' => 'simpletest_description'), ); // Define the images used to expand/collapse the test groups. $js = array( 'images' => array( - 0 => theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'), - 1 => theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'), + theme('image', 'misc/menu-collapsed.png', 'Expand', 'Expand'), + theme('image', 'misc/menu-expanded.png', 'Collapsed', 'Collapsed'), ), ); @@ -303,7 +303,7 @@ function theme_simpletest_result_summary($form, $text = NULL) { } function _simpletest_format_summary_line($summary) { - return t('@pass, @fail, @exception', array( + return t('@pass, @fail, and @exception', array( '@pass' => format_plural(isset($summary['#pass']) ? $summary['#pass'] : 0, '1 pass', '@count passes'), '@fail' => format_plural(isset($summary['#fail']) ? $summary['#fail'] : 0, '1 fail', '@count fails'), '@exception' => format_plural(isset($summary['#exception']) ? $summary['#exception'] : 0, '1 exception', '@count exceptions'), @@ -333,7 +333,8 @@ function simpletest_test_form_submit($form, &$form_state) { } /** - * Actually runs tests + * Actually runs tests. + * * @param $test_list * List of tests to run. * @param $reporter @@ -345,6 +346,12 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') { cache_clear_all(); $test_id = db_insert('simpletest_test_id')->useDefaults(array('test_id'))->execute(); + // Get the info for the first test being run. + $first_test = array_shift($test_list); + $first_instance = new $first_test(); + array_unshift($test_list, $first_test); + $info = $first_instance->getInfo(); + $batch = array( 'title' => t('Running SimpleTests'), 'operations' => array( @@ -352,9 +359,10 @@ function simpletest_run_tests($test_list, $reporter = 'drupal') { ), 'finished' => '_simpletest_batch_finished', 'redirect' => 'admin/build/testing', - 'progress_message' => t('Processing tests.'), + 'progress_message' => '', 'css' => array(drupal_get_path('module', 'simpletest') . '/simpletest.css'), - 'init_message' => t('SimpleTest is initializing...') . ' ' . format_plural(count($test_list), "one test case will run.", "@count test cases will run."), + 'js' => array(drupal_get_path('module', 'simpletest') .'/simpletest.js'), + 'init_message' => t('Processing test @num of @max - %test.', array('%test' => $info['name'], '@num' => '1', '@max' => count($test_list))), ); batch_set($batch); // Normally, the forms portion of the batch API takes care of calling @@ -402,12 +410,11 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) { $test_results[$test_class]['#name'] = $info['name']; $items = array(); foreach (element_children($test_results) as $class) { - $items[] = '
' . t('@name: @summary', array('@name' => $test_results[$class]['#name'], '@summary' => _simpletest_format_summary_line($test_results[$class]))) . '
'; + array_unshift($items, '
' . t('@name: @summary', array('@name' => $test_results[$class]['#name'], '@summary' => _simpletest_format_summary_line($test_results[$class]))) . '
'); } - $message = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max)); - $message .= theme('item_list', $items); - $context['message'] = $message; - // TODO: Do we want a summary of all? + $context['message'] = t('Processed test @num of @max - %test.', array('%test' => $info['name'], '@num' => $max - $size, '@max' => $max)); + $context['message'] .= '
Overall results: ' . _simpletest_format_summary_line($test_results) . '
'; + $context['message'] .= theme('item_list', $items); // Save working values for the next iteration. $context['sandbox']['tests'] = $test_list; @@ -420,7 +427,9 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) { } function _simpletest_batch_finished($success, $results, $operations) { - $_SESSION['test_id'] = $results['test_id']; + if (isset($results['test_id'])) { + $_SESSION['test_id'] = $results['test_id']; + } if ($success) { drupal_set_message(t('The tests have finished running.')); }