Skip to content
Snippets Groups Projects
Commit c27852ce authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2560643 by chx, Mixologic, dawehner, larowlan: Fatal PHPUnit tests are...

Issue #2560643 by chx, Mixologic, dawehner, larowlan: Fatal PHPUnit tests are not always reported as failure
parent dbf74b37
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -178,8 +178,25 @@ function simpletest_run_tests($test_list) {
*/
function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames) {
$phpunit_file = simpletest_phpunit_xml_filepath($test_id);
simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file);
return simpletest_phpunit_xml_to_rows($test_id, $phpunit_file);
$ret = simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file);
if ($ret) {
// Something broke during the execution of phpunit.
// Return an error record of all failed classes.
$rows[] = [
'test_id' => '1',
'test_class' => implode(",", $unescaped_test_classnames),
'status' => 'fail',
'message' => 'PHPunit Test failed to complete',
'message_group' => 'Other',
'function' => implode(",", $unescaped_test_classnames),
'line' => '0',
'file' => $phpunit_file,
];
}
else {
$rows = simpletest_phpunit_xml_to_rows($test_id, $phpunit_file);
}
return $rows;
}
/**
......@@ -274,7 +291,7 @@ function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpun
// exec in a subshell so that the environment is isolated when running tests
// via the simpletest UI.
$ret = exec(join($command, " "));
exec(join($command, " "), $output, $ret);
chdir($old_cwd);
putenv('SIMPLETEST_DB=');
return $ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment