Skip to content

Commit

Permalink
Merge branch '4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
whatthejeff committed Jul 22, 2014
2 parents 239ac67 + 6e521ae commit e243de0
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/Util/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private function processChildResult(PHPUnit_Framework_Test $test, PHPUnit_Framew

if ($childResult !== false) {
if (!empty($childResult['output'])) {
print $childResult['output'];
$output = $childResult['output'];
}

$test->setResult($childResult['testResult']);
Expand Down Expand Up @@ -200,6 +200,10 @@ private function processChildResult(PHPUnit_Framework_Test $test, PHPUnit_Framew
}

$result->endTest($test, $time);

if (!empty($output)) {
print $output;
}
}

/**
Expand Down
3 changes: 1 addition & 2 deletions src/Util/PHP/Template/TestCaseMethod.tpl.dist
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ function __phpunit_run_isolated_test()
$test->setInIsolation(TRUE);

ob_end_clean();
ob_start();
$test->run($result);
$output = ob_get_clean();
$output = $test->getActualOutput();

print serialize(
array(
Expand Down
20 changes: 20 additions & 0 deletions tests/Regression/GitHub/1149.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
GH-1149: Test swallows output buffer when run in a separate process
--FILE--
<?php

$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = 'Issue1149Test';
$_SERVER['argv'][3] = dirname(__FILE__).'/1149/Issue1149Test.php';

require __DIR__ . '/../../bootstrap.php';
PHPUnit_TextUI_Command::main();
?>
--EXPECTF--
PHPUnit %s by Sebastian Bergmann.

.1.2

Time: %s, Memory: %sMb

OK (2 tests, 2 assertions)
18 changes: 18 additions & 0 deletions tests/Regression/GitHub/1149/Issue1149Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
class Issue1149Test extends PHPUnit_Framework_TestCase
{
public function testOne()
{
$this->assertTrue(true);
print '1';
}

/**
* @runInSeparateProcess
*/
public function testTwo()
{
$this->assertTrue(true);
print '2';
}
}

0 comments on commit e243de0

Please sign in to comment.