function JUnitConverter::convertTestCaseToSimpletestRow
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow()
- 8.9.x core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow()
- 10 core/lib/Drupal/Core/Test/JUnitConverter.php \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow()
Converts a PHPUnit test case result to a {simpletest} result row.
@internal
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.
1 call to JUnitConverter::convertTestCaseToSimpletestRow()
- JUnitConverter::xmlElementToRows in core/
lib/ Drupal/ Core/ Test/ JUnitConverter.php - Parse test cases from XML to {simpletest} schema.
File
-
core/
lib/ Drupal/ Core/ Test/ JUnitConverter.php, line 100
Class
- JUnitConverter
- Converts JUnit XML to Drupal's {simpletest} schema.
Namespace
Drupal\Core\TestCode
public static function convertTestCaseToSimpletestRow($test_id, \SimpleXMLElement $test_case) : array {
$status = static::getTestCaseResult($test_case);
$attributes = $test_case->attributes();
$message = match ($status) { PhpUnitTestCaseJUnitResult::Fail => (string) $test_case->failure[0],
PhpUnitTestCaseJUnitResult::Error => (string) $test_case->error[0],
default => '',
};
return [
'test_id' => $test_id,
'test_class' => (string) $attributes->class,
'status' => $status->value,
'message' => $message,
'message_group' => 'Other',
'function' => $attributes->name,
'line' => (int) $attributes->line ?: 0,
'file' => (string) $attributes->file,
'time' => (double) $attributes->time,
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.