class JUnitConverter (View source)

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

This is mainly for converting PHPUnit test results.

This class is @internal and not considered to be API.

Methods

static array[]
xmlToRows(int $test_id, string $phpunit_xml_file)

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

static array[]
xmlElementToRows(int $test_id, SimpleXMLElement $element)

Parse test cases from XML to {simpletest} schema.

static array
findTestCases(SimpleXMLElement $element, SimpleXMLElement $parent = NULL)

Finds all test cases recursively from a test suite list.

static array
convertTestCaseToSimpletestRow(int $test_id, SimpleXMLElement $test_case)

Converts a PHPUnit test case result to a {simpletest} result row.

Details

static array[] xmlToRows(int $test_id, string $phpunit_xml_file)

internal  
 

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

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.

static array[] xmlElementToRows(int $test_id, SimpleXMLElement $element)

internal  
 

Parse test cases from XML to {simpletest} schema.

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.

static array findTestCases(SimpleXMLElement $element, SimpleXMLElement $parent = NULL)

internal  
 

Finds all test cases recursively from a test suite list.

Parameters

SimpleXMLElement $element

The PHPUnit xml to search for test cases.

SimpleXMLElement $parent

(Optional) The parent of the current element. Defaults to NULL.

Return Value

array

A list of all test cases.

static array convertTestCaseToSimpletestRow(int $test_id, SimpleXMLElement $test_case)

internal  
 

Converts a PHPUnit test case result to a {simpletest} result row.

Parameters

int $test_id

The current test ID.

SimpleXMLElement $test_case

The PHPUnit test case represented as XML element.

Return Value

array

An array containing the {simpletest} result row.