From dea724330305c92ecb10076e6cbb8725ce729c7a Mon Sep 17 00:00:00 2001 From: Lucas Werkmeister Date: Wed, 24 Jan 2018 14:29:23 +0100 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20write=20to=20stderr=20when=20tes?= =?utf8?q?ting?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This change makes it possible to test error() messages with expectOutputString() or expectOutputRegex(). Change-Id: I61970403f9c371d3798f34fd48c70bc72f0c7eda --- maintenance/Maintenance.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.20.1