function SimpletestTestRunResultsStorage::buildTestingResultsEnvironment

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

Overrides TestRunResultsStorageInterface::buildTestingResultsEnvironment

File

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

Class

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

Namespace

Drupal\Core\Test

Code

public function buildTestingResultsEnvironment(bool $keep_results) : void {
    $schema = $this->connection
        ->schema();
    foreach (static::testingResultsSchema() as $name => $table_spec) {
        $table_exists = $schema->tableExists($name);
        if (!$keep_results && $table_exists) {
            $this->connection
                ->truncate($name)
                ->execute();
        }
        if (!$table_exists) {
            $schema->createTable($name, $table_spec);
        }
    }
}

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