- # Make sure we have --configuration or PHPUnit might complain
- if ( !in_array( '--configuration', $_SERVER['argv'] ) ) {
- // Hack to eliminate the need to use the Makefile (which sucks ATM)
- array_splice( $_SERVER['argv'], 1, 0,
- [ '--configuration', $IP . '/tests/phpunit/suite.xml' ] );
- }
-
- $phpUnitClass = PHPUnit_TextUI_Command::class;
-
- if ( $this->hasOption( 'with-phpunitclass' ) ) {
- $phpUnitClass = $this->getOption( 'with-phpunitclass' );
-
- # Cleanup $args array so the option and its value do not
- # pollute PHPUnit
- $key = array_search( '--with-phpunitclass', $_SERVER['argv'] );
- unset( $_SERVER['argv'][$key] ); // the option
- unset( $_SERVER['argv'][$key + 1] ); // its value
- $_SERVER['argv'] = array_values( $_SERVER['argv'] );
- }
-
- $key = array_search( '--debug-tests', $_SERVER['argv'] );
- if ( $key !== false && array_search( '--printer', $_SERVER['argv'] ) === false ) {
- unset( $_SERVER['argv'][$key] );
- array_splice( $_SERVER['argv'], 1, 0, 'MediaWikiPHPUnitTestListener' );
- array_splice( $_SERVER['argv'], 1, 0, '--printer' );
- }
-
- foreach ( self::$additionalOptions as $option => $default ) {
- $key = array_search( '--' . $option, $_SERVER['argv'] );
- if ( $key !== false ) {
- unset( $_SERVER['argv'][$key] );
- if ( $this->mParams[$option]['withArg'] ) {
- self::$additionalOptions[$option] = $_SERVER['argv'][$key + 1];
- unset( $_SERVER['argv'][$key + 1] );
- } else {
- self::$additionalOptions[$option] = true;
- }
- }
- }
-