From: Tim Starling Date: Mon, 25 May 2020 03:48:42 +0000 (+1000) Subject: Call ob_start() before running tests X-Git-Tag: 1.31.8~5 X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=af0e7338dd24ed7e7e15cc7c47b5a6ba0e376bc0 Call ob_start() before running tests The policy introduced for T206476 creates a subtle failure mode: any test writing to stdout will cause headers to be sent, causing later tests to fail when they try to call header(). Instead, call ob_start() to intercept test output. Any buffered output is still seen when PHPUnit exits. Bug: T206476 Change-Id: Id085efeab67d1e700ffcbf37868b5107e3a7e5d5 --- diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 650cfcfa3a..6036e3fb82 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -124,6 +124,10 @@ class PHPUnitMaintClass extends Maintenance { exit( 1 ); } + // Start an output buffer to avoid headers being sent by constructors, + // data providers, etc. (T206476) + ob_start(); + fwrite( STDERR, defined( 'HHVM_VERSION' ) ? 'Using HHVM ' . HHVM_VERSION . ' (' . PHP_VERSION . ")\n" : 'Using PHP ' . PHP_VERSION . "\n" );