function simpletest_clean_results_table in SimpleTest 6.2
Same name and namespace in other branches
- 8.3 simpletest.module \simpletest_clean_results_table()
- 7.2 simpletest.module \simpletest_clean_results_table()
- 7 simpletest.module \simpletest_clean_results_table()
Clear the test result tables.
Parameters
$test_id: Test ID to remove results for, or NULL to remove all results.
Return value
The number of results removed.
2 calls to simpletest_clean_results_table()
- simpletest_clean_environment in ./
simpletest.module - Remove all temporary database tables and directories.
- simpletest_result_form in ./
simpletest.pages.inc - Test results form for $test_id.
File
- ./
simpletest.module, line 460 - Provides testing functionality.
Code
function simpletest_clean_results_table($test_id = NULL) {
if (variable_get('simpletest_clear_results', TRUE)) {
if ($test_id) {
$count = db_result(db_query('SELECT COUNT(test_id) FROM {simpletest_test_id} WHERE test_id = %d', $test_id));
db_query("DELETE FROM {simpletest} WHERE test_id = %d", $test_id);
db_query("DELETE FROM {simpletest_test_id} WHERE test_id = %d", $test_id);
}
else {
$count = db_result(db_query('SELECT COUNT(test_id) FROM {simpletest_test_id}'));
// Clear test results.
db_query('DELETE FROM {simpletest}');
db_query('DELETE FROM {simpletest_test_id}');
}
return $count;
}
return 0;
}