function simpletest_run_tests in SimpleTest 7
Same name and namespace in other branches
- 8.3 simpletest.module \simpletest_run_tests()
- 5 simpletest.module \simpletest_run_tests()
- 6.2 simpletest.module \simpletest_run_tests()
- 6 simpletest.module \simpletest_run_tests()
- 7.2 simpletest.module \simpletest_run_tests()
Actually runs tests.
Parameters
$test_list: List of tests to run.
$reporter: Which reporter to use. Allowed values are: text, xml, html and drupal, drupal being the default.
1 call to simpletest_run_tests()
- simpletest_test_form_submit in ./
simpletest.pages.inc - Run selected tests.
File
- ./
simpletest.module, line 134 - Provides testing functionality.
Code
function simpletest_run_tests($test_list, $reporter = 'drupal') {
cache_clear_all();
$test_id = db_insert('simpletest_test_id')
->useDefaults(array(
'test_id',
))
->execute();
// Clear out the previous verbose files.
file_unmanaged_delete_recursive(file_directory_path() . '/simpletest/verbose');
// 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 tests'),
'operations' => array(
array(
'_simpletest_batch_operation',
array(
$test_list,
$test_id,
),
),
),
'finished' => '_simpletest_batch_finished',
'progress_message' => '',
'css' => array(
drupal_get_path('module', 'simpletest') . '/simpletest.css',
),
'init_message' => t('Processing test @num of @max - %test.', array(
'%test' => $info['name'],
'@num' => '1',
'@max' => count($test_list),
)),
);
batch_set($batch);
module_invoke_all('test_group_started');
// Normally, the forms portion of the batch API takes care of calling
// batch_process(), but in the process it saves the whole $form into the
// database (which is huge for the test selection form).
// By calling batch_process() directly, we skip that behavior and ensure
// that we don't exceed the size of data that can be sent to the database
// (max_allowed_packet on MySQL).
batch_process('admin/config/development/testing/results/' . $test_id);
}