Use separate PoolCounter config for expensive thumbnails
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
index 8e2bc03..d2a4132 100755 (executable)
@@ -6,7 +6,8 @@
  * @file
  */
 
-// Set a flag which can be used to detect when other scripts have been entered through this entry point or not
+// Set a flag which can be used to detect when other scripts have been entered
+// through this entry point or not.
 define( 'MW_PHPUNIT_TEST', true );
 
 // Start up MediaWiki in command-line mode
@@ -16,8 +17,10 @@ class PHPUnitMaintClass extends Maintenance {
 
        public function __construct() {
                parent::__construct();
-               $this->addOption( 'with-phpunitdir',
-                       'Directory to include PHPUnit from, for example when using a git fetchout from upstream. Path will be prepended to PHP `include_path`.',
+               $this->addOption(
+                       'with-phpunitdir',
+                       'Directory to include PHPUnit from, for example when using a git '
+                               . 'fetchout from upstream. Path will be prepended to PHP `include_path`.',
                        false, # not required
                        true # need arg
                );
@@ -57,6 +60,8 @@ class PHPUnitMaintClass extends Maintenance {
                                return false;
                        }
                );
+               // xdebug's default of 100 is too low for MediaWiki
+               ini_set( 'xdebug.max_nesting_level', 1000 );
        }
 
        public function execute() {
@@ -91,6 +96,33 @@ class PHPUnitMaintClass extends Maintenance {
                        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 ) {
+                               array_splice( $_SERVER['argv'], 1, 0, '--colors' );
+                       }
+               }
+
+               # 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
+               # See bug 32022
+               $key = array_search( '--include-path', $_SERVER['argv'] );
+               if( $key === false ) {
+                       array_splice( $_SERVER['argv'], 1, 0,
+                               __DIR__
+                               . PATH_SEPARATOR
+                               . get_include_path()
+                       );
+                       array_splice( $_SERVER['argv'], 1, 0, '--include-path' );
+               }
        }
 
        public function getDbType() {