function SimpletestTestRunResultsStorage::removeResults

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php \Drupal\Core\Test\SimpletestTestRunResultsStorage::removeResults()

Removes the results of a test run from the storage.

Parameters

\Drupal\Core\Test\TestRun $test_run: The test run object.

Return value

int The number of log entries that were removed from storage.

Overrides TestRunResultsStorageInterface::removeResults

File

core/lib/Drupal/Core/Test/SimpletestTestRunResultsStorage.php, line 97

Class

SimpletestTestRunResultsStorage
Implements a test run results storage compatible with legacy Simpletest.

Namespace

Drupal\Core\Test

Code

public function removeResults(TestRun $test_run) : int {
  $this->connection
    ->startTransaction('delete_test_run');
  $this->connection
    ->delete('simpletest')
    ->condition('test_id', $test_run->id())
    ->execute();
  $count = $this->connection
    ->delete('simpletest_test_id')
    ->condition('test_id', $test_run->id())
    ->execute();
  return $count;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.