function simpletest_phpunit_testcase_to_row in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/simpletest.module \simpletest_phpunit_testcase_to_row()
Converts a PHPUnit test case result to a {simpletest} result row.
Parameters
int $test_id: The current test ID.
\SimpleXMLElement $testcase: The PHPUnit test case represented as XML element.
Return value
array An array containing the {simpletest} result row.
1 call to simpletest_phpunit_testcase_to_row()
- simpletest_phpunit_xml_to_rows in core/
modules/ simpletest/ simpletest.module - Converts PHPUnit's JUnit XML output to an array.
File
- core/
modules/ simpletest/ simpletest.module, line 759 - Provides testing functionality.
Code
function simpletest_phpunit_testcase_to_row($test_id, \SimpleXMLElement $testcase) {
$message = '';
$pass = TRUE;
if ($testcase->failure) {
$lines = explode("\n", $testcase->failure);
$message = $lines[2];
$pass = FALSE;
}
if ($testcase->error) {
$message = $testcase->error;
$pass = FALSE;
}
$attributes = $testcase
->attributes();
$record = array(
'test_id' => $test_id,
'test_class' => (string) $attributes->class,
'status' => $pass ? 'pass' : 'fail',
'message' => $message,
// @todo: Check on the proper values for this.
'message_group' => 'Other',
'function' => $attributes->class . '->' . $attributes->name . '()',
'line' => $attributes->line ?: 0,
'file' => $attributes->file,
);
return $record;
}