function _simpletest_batch_operation($tests_init, $reporter_init, &$context) { // Ensure that all classes are loaded before we unserialize some instances. simpletest_get_total_test(); if (!isset($context['sandbox']['max'])) { $context['sandbox']['max'] = $tests->getSize(); $tests = unserialize($tests_init); $reporter = unserialize($reporter_init); } else { $tests = unserialize($context['sandbox']['tests']); $reporter = unserialize($context['results']); } $test_ran = $tests->runOneByOne($reporter); $size = $tests->getSize(); $context['message'] = t('Processed test %test (remaining: @count of @max). !passes passes, !fails fails, !exceptions exceptions.', array('%test' => $test_ran, '@count' => $size, '@max' => $context['sandbox']['max'], '!passes' => $reporter->_passes, '!fails' => $reporter->_fails, '!exceptions' => $reporter->_exceptions)); // Put back the tests and reporter. $context['sandbox']['tests'] = serialize($tests); $context['results'] = serialize($reporter); // Multistep processing: report progress. if ($size) { $context['finished'] = 1 - $size / $context['sandbox']['max']; } } function _simpletest_batch_finished($success, $results, $operations) { $_SESSION['simpletest_reporter'] = $results; if ($success) { drupal_set_message(t('The tests have finished running.')); } else { drupal_set_message(t('The tests did not successfully finish.'), 'error'); } }