1 simpletest.module _simpletest_batch_finished($success, $results, $operations, $elapsed)

File

core/modules/simpletest/simpletest.module, line 248
Provides testing functionality.

Code

function _simpletest_batch_finished($success, $results, $operations, $elapsed) {
  if ($success) {
    backdrop_set_message(t('The test run finished in @elapsed.', array('@elapsed' => $elapsed)));
  }
  else {
    // If any uncompleted operations are left, we can use the next item to pull
    // the test_id and report any errors from the test log.
    if (!empty($operations)) {
      // Use the test_id passed as a parameter to _simpletest_batch_operation().
      $next_operation = reset($operations);
      $test_id = $next_operation[1][1];

      // Retrieve the last database prefix used for testing and the last test
      // class that was run from. Use the information to read the lgo file
      // in case any fatal errors caused the test to crash.
      list($last_prefix, $last_test_class) = simpletest_last_test_get($test_id);
      simpletest_log_read($test_id, $last_prefix, $last_test_class);
    }

    backdrop_set_message(t('The test run did not successfully finish.'), 'error');
    backdrop_set_message(t('Use the <em>Clean environment</em> button to clean-up temporary files and tables.'), 'warning');
  }
  module_invoke_all('test_group_finished');
}