function JUnitConverter::xmlToRows

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::xmlToRows()
  2. 10 core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::xmlToRows()
  3. 11.x 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.

3 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
Tests errors reported. @covers ::xmlToRows
PhpUnitTestRunner::runTests in core/lib/Drupal/Core/Test/PhpUnitTestRunner.php
Executes PHPUnit tests and returns the results of the run.

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));
}

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