Merge "Remove ParserOptions::setSkin() (deprecated since 1.19)"
[mediawiki.git] / tests / phpunit / MediaWikiPHPUnitCommand.php
blobfa863fc57f4b4e95cdea86c0f512164c92424826
1 <?php
3 class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command {
5 public static $additionalOptions = array(
6 'regex=' => false,
7 'file=' => false,
8 'use-filebackend=' => false,
9 'use-bagostuff=' => false,
10 'use-jobqueue=' => false,
11 'keep-uploads' => false,
12 'use-normal-tables' => false,
13 'reuse-db' => false,
14 'wiki=' => false,
15 'debug-tests' => false,
18 public function __construct() {
19 foreach ( self::$additionalOptions as $option => $default ) {
20 $this->longOptions[$option] = $option . 'Handler';
24 protected function handleArguments( array $argv ) {
25 parent::handleArguments( $argv );
27 if ( !isset( $this->arguments['listeners'] ) ) {
28 $this->arguments['listeners'] = array();
31 foreach ( $this->options[0] as $option ) {
32 switch ( $option[0] ) {
33 case '--debug-tests':
34 $this->arguments['listeners'][] = new MediaWikiPHPUnitTestListener( 'PHPUnitCommand' );
35 break;
40 public static function main( $exit = true ) {
41 $command = new self;
42 $command->run( $_SERVER['argv'], $exit );
45 public function __call( $func, $args ) {
47 if ( substr( $func, -7 ) == 'Handler' ) {
48 if ( is_null( $args[0] ) ) {
49 $args[0] = true;
50 } //Booleans
51 self::$additionalOptions[substr( $func, 0, -7 )] = $args[0];
55 public function showHelp() {
56 parent::showHelp();
58 print <<<EOT
60 ParserTest-specific options:
61 --regex="<regex>" Only run parser tests that match the given regex
62 --file="<filename>" File describing parser tests
63 --keep-uploads Re-use the same upload directory for each test, don't delete it
65 Database options:
66 --use-normal-tables Use normal DB tables.
67 --reuse-db Init DB only if tables are missing and keep after finish.
69 Debugging options:
70 --debug-tests Log testing activity to the PHPUnitCommand log channel.
72 EOT;