* @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
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
);
return false;
}
);
+ // xdebug's default of 100 is too low for MediaWiki
+ ini_set( 'xdebug.max_nesting_level', 1000 );
}
public function execute() {
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() {