Addshore has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/131448

Change subject: RM color opt setting from MediaWikiPHPUnitCommand
......................................................................

RM color opt setting from MediaWikiPHPUnitCommand

Change-Id: I08d3b53f80520452aef3fcf2017747406a38664d
---
M tests/phpunit/MediaWikiPHPUnitCommand.php
M tests/phpunit/phpunit.php
M tests/phpunit/suite.xml
3 files changed, 18 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/48/131448/1

diff --git a/tests/phpunit/MediaWikiPHPUnitCommand.php 
b/tests/phpunit/MediaWikiPHPUnitCommand.php
index cc49fde..7241f0a 100644
--- a/tests/phpunit/MediaWikiPHPUnitCommand.php
+++ b/tests/phpunit/MediaWikiPHPUnitCommand.php
@@ -40,17 +40,6 @@
        public static function main( $exit = true ) {
                $command = new self;
 
-               if ( wfIsWindows() ) {
-                       # Windows does not come anymore with ANSI.SYS loaded by 
default
-                       # PHPUnit uses the suite.xml parameters to 
enable/disable colors
-                       # which can be then forced to be enabled with --colors.
-                       # The below code inject a parameter just like if the 
user called
-                       # phpunit with a --no-color option (which does not 
exist). It
-                       # overrides the suite.xml setting.
-                       # Probably fix bug 29226
-                       $command->arguments['colors'] = false;
-               }
-
                # Makes MediaWiki PHPUnit directory includable so the PHPUnit 
will
                # be able to resolve relative files inclusion such as suites/*
                # PHPUnit uses stream_resolve_include_path() internally
diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php
index 2b77752..d85ac0e 100755
--- a/tests/phpunit/phpunit.php
+++ b/tests/phpunit/phpunit.php
@@ -94,6 +94,19 @@
                        unset( $_SERVER['argv'][$key + 1] ); // its value
                        $_SERVER['argv'] = array_values( $_SERVER['argv'] );
                }
+
+               if ( !wfIsWindows() ) {
+                       # If we are not running on windows then we can enable 
phpunit colors
+                       # Windows does not come anymore with ANSI.SYS loaded by 
default
+                       # PHPUnit uses the suite.xml parameters to 
enable/disable colors
+                       # which can be then forced to be enabled with --colors.
+                       # The below code injects a parameter just like if the 
user called
+                       # Probably fix bug 29226
+                       $key = array_search( '--colors', $_SERVER['argv'] );
+                       if( $key === false ) {
+                               $_SERVER['argv'][] = '--colors';
+                       }
+               }
        }
 
        public function getDbType() {
diff --git a/tests/phpunit/suite.xml b/tests/phpunit/suite.xml
index 3b0bf6b..574c11e 100644
--- a/tests/phpunit/suite.xml
+++ b/tests/phpunit/suite.xml
@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<!-- colors don't work on Windows! -->
+<!--
+Colors don't work on Windows!
+phpunit.php enables colors for other OSs at runtime
+-->
 <phpunit bootstrap="./bootstrap.php"
-       colors="true"
+       colors="false"
        backupGlobals="false"
        convertErrorsToExceptions="true"
        convertNoticesToExceptions="true"

-- 
To view, visit https://gerrit.wikimedia.org/r/131448
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I08d3b53f80520452aef3fcf2017747406a38664d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to