w/s changes.
[lhc/web/wiklou.git] / tests / phpunit / MediaWikiPHPUnitCommand.php
1 <?php
2
3 class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command {
4
5 static $additionalOptions = array(
6 'regex=' => false,
7 'file=' => false,
8 'keep-uploads' => false,
9 );
10
11 public function __construct() {
12 foreach( self::$additionalOptions as $option => $default ) {
13 $this->longOptions[$option] = $option . 'Handler';
14 }
15
16 }
17
18 public static function main( $exit = true ) {
19 $command = new self;
20 $command->run($_SERVER['argv'], $exit);
21 }
22
23 public function __call( $func, $args ) {
24
25 if( substr( $func, -7 ) == 'Handler' ) {
26 if( is_null( $args[0] ) ) $args[0] = true; //Booleans
27 self::$additionalOptions[substr( $func, 0, -7 ) ] = $args[0];
28 }
29 }
30
31 public function showHelp() {
32 parent::showHelp();
33
34 print <<<EOT
35
36 ParserTest-specific options:
37
38 --regex="<regex>" Only run parser tests that match the given regex
39 --file="<filename>" Prints the version and exits.
40 --keep-uploads Re-use the same upload directory for each test, don't delete it
41
42
43 EOT;
44 }
45
46 }