You are here

public static function JUnitConverter::xmlToRows in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::xmlToRows()

Converts PHPUnit's JUnit XML output file to {simpletest} schema.

@internal

Parameters

int $test_id: The current test ID.

string $phpunit_xml_file: Path to the PHPUnit XML file.

Return value

array[] The results as array of rows in a format that can be inserted into the {simpletest} table of the results database.

4 calls to JUnitConverter::xmlToRows()
JUnitConverterTest::testXmlToRowsEmptyFile in core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
@covers ::xmlToRows
JUnitConverterTest::testXmlToRowsWithErrors in core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
Test errors reported. @covers ::xmlToRows
PhpUnitTestRunner::runTests in core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
Executes PHPUnit tests and returns the results of the run.
simpletest_phpunit_xml_to_rows in core/modules/simpletest/simpletest.module
Converts PHPUnit's JUnit XML output to an array.

File

core/lib/Drupal/Core/Test/JUnitConverter.php, line 28

Class

JUnitConverter
Converts JUnit XML to Drupal's {simpletest} schema.

Namespace

Drupal\Core\Test

Code

public static function xmlToRows($test_id, $phpunit_xml_file) {
  $contents = @file_get_contents($phpunit_xml_file);
  if (!$contents) {
    return [];
  }
  return static::xmlElementToRows($test_id, new \SimpleXMLElement($contents));
}