diff --git a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php index cc101db..6dfe6b7 100644 --- a/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php +++ b/core/lib/Drupal/Core/Test/PhpUnitTestRunner.php @@ -126,8 +126,9 @@ public function phpUnitCommand() { * @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. + * @param string[] $output + * (optional) The output by running the phpunit command. If provided, this + * array will contain the lines output by the command. * * @return string * The results as returned by exec(). @@ -180,7 +181,7 @@ public function runCommand(array $unescaped_test_classnames, $phpunit_file, &$st // Execute in a subshell so that the environment is isolated when running // tests via the simpletest UI. // @todo Convert to Symfony process framework. - $ret = exec(implode(' ', $command), $output, $status); + $ret = exec(implode(" ", $command), $output, $status); chdir($old_cwd); putenv('SIMPLETEST_DB='); @@ -207,8 +208,9 @@ public function runCommand(array $unescaped_test_classnames, $phpunit_file, &$st * {simpletest}'s schema. */ public function runTests($test_id, array $unescaped_test_classnames, &$status = NULL) { - $phpunit_file = $this->xmlLogFilepath($test_id); + // Store ouptut from our test run. + $output = []; $this->runCommand($unescaped_test_classnames, $phpunit_file, $status, $output); $rows = JUnitConverter::xmlToRows($test_id, $phpunit_file); diff --git a/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php index d283a6d..bd7a49d 100644 --- a/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php +++ b/core/tests/Drupal/Tests/Core/Test/PhpUnitTestRunnerTest.php @@ -18,6 +18,7 @@ class PhpUnitTestRunnerTest extends \PHPUnit_Framework_TestCase { * @covers ::runTests */ public function testRunTestsError() { + $test_id = 23; $log_path = 'test_log_path'; // Create a mock runner. @@ -43,7 +44,7 @@ function ($unescaped_test_classnames, $phpunit_file, &$status) { // The runTests() method expects $status by reference, so we initialize it // to some value we don't expect back. $status = -1; - $results = $runner->runTests(23, ['SomeTest'], $status); + $results = $runner->runTests($test_id, ['SomeTest'], $status); // Make sure our status code made the round trip. $this->assertEquals(2, $status); @@ -51,10 +52,10 @@ function ($unescaped_test_classnames, $phpunit_file, &$status) { // A serious error in runCommand() should give us a fixed set of results. $row = reset($results); $fail_row = [ - 'test_id' => '1', + 'test_id' => $test_id, 'test_class' => 'SomeTest', 'status' => 'fail', - 'message' => 'PHPunit Test failed to complete', + 'message' => 'PHPunit Test failed to complete; Error: ', 'message_group' => 'Other', 'function' => 'SomeTest', 'line' => '0',