3 class MediaWikiPHPUnitCommand
extends PHPUnit_TextUI_Command
{
5 static $additionalOptions = array(
8 'use-filebackend=' => false,
9 'keep-uploads' => false,
10 'use-normal-tables' => false,
14 public function __construct() {
15 foreach( self
::$additionalOptions as $option => $default ) {
16 $this->longOptions
[$option] = $option . 'Handler';
21 public static function main( $exit = true ) {
25 # Windows does not come anymore with ANSI.SYS loaded by default
26 # PHPUnit uses the suite.xml parameters to enable/disable colors
27 # which can be then forced to be enabled with --colors.
28 # The below code inject a parameter just like if the user called
29 # phpunit with a --no-color option (which does not exist). It
30 # overrides the suite.xml setting.
31 # Probably fix bug 29226
32 $command->arguments
['colors'] = false;
35 # Makes MediaWiki PHPUnit directory includable so the PHPUnit will
36 # be able to resolve relative files inclusion such as suites/*
37 # PHPUnit uses stream_resolve_include_path() internally
45 $command->run($_SERVER['argv'], $exit);
48 public function __call( $func, $args ) {
50 if( substr( $func, -7 ) == 'Handler' ) {
51 if( is_null( $args[0] ) ) $args[0] = true; //Booleans
52 self
::$additionalOptions[substr( $func, 0, -7 ) ] = $args[0];
56 public function showHelp() {
61 ParserTest-specific options:
63 --regex="<regex>" Only run parser tests that match the given regex
64 --file="<filename>" Prints the version and exits.
65 --keep-uploads Re-use the same upload directory for each test, don't delete it
69 --use-normal-tables Use normal DB tables.
70 --reuse-db Init DB only if tables are missing and keep after finish.