You are here

public static function JUnitConverter::xmlElementToRows in Drupal 8

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

Parse test cases from XML to {simpletest} schema.

@internal

Parameters

int $test_id: The current test ID.

\SimpleXMLElement $element: The XML data from the JUnit 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.

2 calls to JUnitConverter::xmlElementToRows()
JUnitConverter::xmlToRows in core/lib/Drupal/Core/Test/JUnitConverter.php
Converts PHPUnit's JUnit XML output file to {simpletest} schema.
JUnitConverterTest::testXmlElementToRows in core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
@covers ::xmlElementToRows

File

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

Class

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

Namespace

Drupal\Core\Test

Code

public static function xmlElementToRows($test_id, \SimpleXMLElement $element) {
  $records = [];
  $test_cases = static::findTestCases($element);
  foreach ($test_cases as $test_case) {
    $records[] = static::convertTestCaseToSimpletestRow($test_id, $test_case);
  }
  return $records;
}