1 simpletest.module simpletest_clean_results_table($test_id = NULL)

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.:

File

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

Code

function simpletest_clean_results_table($test_id = NULL) {
  if (config_get('simpletest.settings', 'simpletest_clear_results')) {
    if ($test_id) {
      $count = db_query('SELECT COUNT(test_id) FROM {simpletest_prefix} WHERE test_id = :test_id', array(':test_id' => $test_id))->fetchField();

      db_delete('simpletest')
        ->condition('test_id', $test_id)
        ->execute();
      db_delete('simpletest_prefix')
        ->condition('test_id', $test_id)
        ->execute();
    }
    else {
      $count = db_query('SELECT COUNT(test_id) FROM {simpletest_prefix}')->fetchField();

      // Clear test results.
      db_delete('simpletest')->execute();
      db_delete('simpletest_prefix')->execute();
    }

    return $count;
  }
  return 0;
}