Commit 1fdf088b authored by alexpott's avatar alexpott

Issue #2799021 by dawehner, Wim Leers: Ensure a failing PHPUnit test shows...

Issue #2799021 by dawehner, Wim Leers: Ensure a failing PHPUnit test shows enough information via run-tests.sh
parent 2317a396
......@@ -181,7 +181,7 @@ function simpletest_run_tests($test_list) {
*/
function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames, &$status = NULL) {
$phpunit_file = simpletest_phpunit_xml_filepath($test_id);
simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file, $status);
simpletest_phpunit_run_command($unescaped_test_classnames, $phpunit_file, $status, $output);
$rows = simpletest_phpunit_xml_to_rows($test_id, $phpunit_file);
// A $status of 0 = passed test, 1 = failed test, > 1 indicates segfault
......@@ -193,13 +193,27 @@ function simpletest_run_phpunit_tests($test_id, array $unescaped_test_classnames
'test_id' => $test_id,
'test_class' => implode(",", $unescaped_test_classnames),
'status' => 'fail',
'message' => 'PHPunit Test failed to complete',
'message' => 'PHPunit Test failed to complete; Error: ' . implode("\n", $output),
'message_group' => 'Other',
'function' => implode(",", $unescaped_test_classnames),
'line' => '0',
'file' => $phpunit_file,
];
}
if ($status === 1) {
$rows[] = [
'test_id' => $test_id,
'test_class' => implode(",", $unescaped_test_classnames),
'status' => 'fail',
'message' => 'PHPunit Test failed to complete; Error: ' . implode("\n", $output),
'message_group' => 'Other',
'function' => implode(",", $unescaped_test_classnames),
'line' => '0',
'file' => $phpunit_file,
];
}
return $rows;
}
......@@ -299,11 +313,13 @@ function simpletest_phpunit_configuration_filepath() {
* @param int $status
* (optional) The exit status code of the PHPUnit process will be assigned to
* this variable.
* @param string $output
* (optional) The output by running the phpunit command.
*
* @return string
* The results as returned by exec().
*/
function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL) {
function simpletest_phpunit_run_command(array $unescaped_test_classnames, $phpunit_file, &$status = NULL, &$output = NULL) {
global $base_url;
// Setup an environment variable containing the database connection so that
// functional tests can connect to the database.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment