You are here

function simpletest_clean_results_table in Drupal 8

Same name and namespace in other branches
  1. 7 modules/simpletest/simpletest.module \simpletest_clean_results_table()

Clears the test result tables.

Parameters

$test_id: Test ID to remove results for, or NULL to remove all results.

Return value

int The number of results that were removed.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Access the environment_cleaner service and call its cleanResultsTable() method, or use \Drupal\Core\Test\EnvironmentCleaner::cleanResultsTable() instead.

See also

https://www.drupal.org/node/3076634

1 call to simpletest_clean_results_table()
DeprecatedCleanupTest::testDeprecatedCleanFunctions in core/modules/simpletest/tests/src/Kernel/DeprecatedCleanupTest.php
@expectedDeprecation simpletest_clean_environment is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Access the environment_cleaner service and call its cleanEnvironment() method, or use…

File

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

Code

function simpletest_clean_results_table($test_id = NULL) {
  @trigger_error(__FUNCTION__ . ' is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Access the environment_cleaner service and call its cleanResultsTable() method, or use \\Drupal\\Core\\Test\\EnvironmentCleaner::cleanResultsTable() instead. See https://www.drupal.org/node/3076634', E_USER_DEPRECATED);
  $count = 0;
  if (\Drupal::config('simpletest.settings')
    ->get('clear_results')) {

    /* @var $cleaner \Drupal\simpletest\EnvironmentCleanerService */
    $cleaner = \Drupal::service('environment_cleaner');
    $count = $cleaner
      ->cleanResultsTable($test_id);
  }
  return $count;
}