You are here

public static function TestDatabase::processPhpUnitResults in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Test/TestDatabase.php \Drupal\Core\Test\TestDatabase::processPhpUnitResults()

Inserts the parsed PHPUnit results into {simpletest}.

@internal

Parameters

array[] $phpunit_results: An array of test results, as returned from \Drupal\Core\Test\JUnitConverter::xmlToRows(). These results are in a form suitable for inserting into the {simpletest} table of the test results database.

File

core/lib/Drupal/Core/Test/TestDatabase.php, line 420

Class

TestDatabase
Provides helper methods for interacting with the fixture database.

Namespace

Drupal\Core\Test

Code

public static function processPhpUnitResults($phpunit_results) {
  if ($phpunit_results) {
    $query = static::getConnection()
      ->insert('simpletest')
      ->fields(array_keys($phpunit_results[0]));
    foreach ($phpunit_results as $result) {
      $query
        ->values($result);
    }
    $query
      ->execute();
  }
}