Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. JUnitConverter.php

function 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.

1 call to JUnitConverter::xmlToRows()
PhpUnitTestRunner::execute 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));
}
RSS feed
Powered by Drupal