sebastianbergmann/phpunit — Issue #443: Output buffering is swallowed in JSON log
Author: NSinopoli
Created: 2011-12-17 01:50:32+00:00
State: open

Somewhat related to https://github.com/sebastianbergmann/phpunit/issues/411 -

The following code:

assertEquals($key, $value, 'test_this() failed!');
}
}

?>

when used in conjunction with PHPUnit_Util_Log_JSON (PHPUnit 3.6.4), returns the following:

string(1431) "{"event":"suiteStart","suite":"","tests":1}{"event":"suiteStart","suite":"PUTest","tests":1}{"event":"testStart","suite":"PUTest","test":"PUTest::test_this"}{"event":"test","suite":"PUTest","test":"PUTest::test_this","status":"fail","time":0.0033881664276123,"trace":[{"file":"\/srv\/http\/pu\/tests\/PUTest.php","line":8,"function":"assertEquals","class":"PHPUnit_Framework_Assert","type":"::","args":["test","value","test_this() failed!"]},{"file":"\/srv\/http\/pu\/lib\/VPU.php","line":743,"function":"run","class":"PHPUnit_Framework_TestSuite","type":"->","args":[{}]},{"file":"\/srv\/http\/pu\/index.php","line":148,"function":"run","class":"VPU","type":"->","args":[["\/srv\/http\/pu\/tests\/PUTest.php",""]]}],"message":"test_this() failed!\nFailed asserting that two strings are equal."}"

PHPUnit 3.5.5 returns the following:

string(1191) "{"event":"suiteStart","suite":"","tests":1}{"event":"suiteStart","suite":"PUTest","tests":1}{"event":"testStart","suite":"PUTest","test":"PUTest::test_this"}some stuff{"event":"test","suite":"PUTest","test":"PUTest::test_this","status":"fail","time":0.041908025741577,"trace":[{"file":"\/srv\/http\/pu\/lib\/VPU.php","line":741,"function":"run","class":"PHPUnit_Framework_TestSuite","type":"->","args":[{}]},{"file":"\/srv\/http\/pu\/index.php","line":148,"function":"run","class":"VPU","type":"->","args":[["\/srv\/http\/pu\/tests\/PUTest.php",""]]}],"message":"test_this() failed!\nFailed asserting that is equal to .\ntest_this() failed!"}"

(Note how "some stuff" is wedged in between the json.)

It would be great if that functionality could be restored. If not, could the output buffering somehow be included in one of the js objects?

Thanks!