Merge "Don’t write to stderr when testing"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 26 Jan 2018 14:12:46 +0000 (14:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 26 Jan 2018 14:12:46 +0000 (14:12 +0000)
1  2 
maintenance/Maintenance.php

@@@ -414,7 -414,10 +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;
                                "must exist and be readable in the source directory.\n" .
                                "Use --conf to specify it." );
                }
 +              if ( isset( $this->mOptions['server'] ) ) {
 +                      $_SERVER['SERVER_NAME'] = $this->mOptions['server'];
 +              }
                $wgCommandLineMode = true;
  
                return $settingsFile;