From: Lucas Werkmeister Date: Wed, 24 Jan 2018 13:29:23 +0000 (+0100) Subject: Don’t write to stderr when testing X-Git-Tag: 1.31.0-rc.0~797^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=dea724330305c92ecb10076e6cbb8725ce729c7a;p=lhc%2Fweb%2Fwiklou.git Don’t write to stderr when testing This change makes it possible to test error() messages with expectOutputString() or expectOutputRegex(). Change-Id: I61970403f9c371d3798f34fd48c70bc72f0c7eda --- diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index 5adbee5fc3..69284ace30 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -414,7 +414,10 @@ abstract class Maintenance { $this->fatalError( $err, intval( $die ) ); } $this->outputChanneled( false ); - if ( PHP_SAPI == 'cli' || PHP_SAPI == 'phpdbg' ) { + if ( + ( PHP_SAPI == 'cli' || PHP_SAPI == 'phpdbg' ) && + !defined( 'MW_PHPUNIT_TEST' ) + ) { fwrite( STDERR, $err . "\n" ); } else { print $err;