- # --with-phpunitdir let us override the default PHPUnit version
- # Can use with either or phpunit.phar in the directory or the
- # full PHPUnit code base.
- if ( $this->hasOption( 'with-phpunitdir' ) ) {
- $phpunitDir = $this->getOption( 'with-phpunitdir' );
-
- # prepends provided PHPUnit directory or phar
- $this->output( "Will attempt loading PHPUnit from `$phpunitDir`\n" );
- set_include_path( $phpunitDir . PATH_SEPARATOR . get_include_path() );
-
- # Cleanup $args array so the option and its value do not
- # pollute PHPUnit
- $key = array_search( '--with-phpunitdir', $_SERVER['argv'] );
- unset( $_SERVER['argv'][$key] ); // the option
- unset( $_SERVER['argv'][$key + 1] ); // its value
- $_SERVER['argv'] = array_values( $_SERVER['argv'] );
- }
-
- # 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' );
- }
-