You are here

function simpletest_phpunit_xml_to_rows in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/simpletest.module \simpletest_phpunit_xml_to_rows()

Converts PHPUnit's JUnit XML output to an array.

Parameters

$test_id: The current test ID.

$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 {simpletest}.

2 calls to simpletest_phpunit_xml_to_rows()
PhpUnitErrorTest::testPhpUnitXmlParsing in core/modules/simpletest/tests/src/Unit/PhpUnitErrorTest.php
Test errors reported.
simpletest_run_phpunit_tests in core/modules/simpletest/simpletest.module
Executes PHPUnit tests and returns the results of the run.

File

core/modules/simpletest/simpletest.module, line 695
Provides testing functionality.

Code

function simpletest_phpunit_xml_to_rows($test_id, $phpunit_xml_file) {
  $contents = @file_get_contents($phpunit_xml_file);
  if (!$contents) {
    return;
  }
  $records = array();
  $testcases = simpletest_phpunit_find_testcases(new SimpleXMLElement($contents));
  foreach ($testcases as $testcase) {
    $records[] = simpletest_phpunit_testcase_to_row($test_id, $testcase);
  }
  return $records;
}