enable colors in PHPUnit (redoing r89179).
authorAntoine Musso <hashar@users.mediawiki.org>
Tue, 16 Aug 2011 18:23:13 +0000 (18:23 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Tue, 16 Aug 2011 18:23:13 +0000 (18:23 +0000)
suite.xml now comes with colors=true. Under Windows, we override the
setting by forging a --no-colors. One can still force color usage
under windows by using --colors.

tests/phpunit/MediaWikiPHPUnitCommand.php
tests/phpunit/suite.xml

index c0d9f36..16f73ef 100644 (file)
@@ -17,6 +17,17 @@ class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command {
 
        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;
+               }
                $command->run($_SERVER['argv'], $exit);
        }
 
index e6649be..c132f5e 100644 (file)
@@ -2,7 +2,7 @@
 
 <!-- colors don't work on Windows! -->
 <phpunit bootstrap="./bootstrap.php"
-         colors="false"
+         colors="true"
          backupGlobals="false"
          convertErrorsToExceptions="true"
          convertNoticesToExceptions="true"