wiki.techinc.nl/tests/phpunit/MediaWikiPHPUnitCommand.php
Tim Starling 15e058d46e Show the PHPUnit help in phpunit.php --help
Split Maintenance::showHelp() from Maintenance::maybeHelp(), and
override it in phpunit.php. Expose PHPUnit's protected method
Command::showHelp() in our subclass and call it, so that running
"phpunit.php  --help" causes the MediaWiki options to be shown, followed
by the PHPUnit options.

Change-Id: I4687d484e322a465af0492789645819cd8a7b67c
2019-11-25 17:19:20 +11:00

29 lines
856 B
PHP

<?php
use PHPUnit\TextUI\Command;
class MediaWikiPHPUnitCommand extends Command {
protected function handleCustomTestSuite() : void {
// Use our suite.xml
if ( !isset( $this->arguments['configuration'] ) ) {
$this->arguments['configuration'] = __DIR__ . '/suite.xml';
}
// Add our own listeners
$this->arguments['listeners'][] = new MediaWikiPHPUnitTestListener;
$this->arguments['listeners'][] = new MediaWikiLoggerPHPUnitTestListener;
// Output only to stderr to avoid "Headers already sent" problems
$this->arguments['stderr'] = true;
// Use a custom result printer that includes per-test logging output
// when nothing is provided.
if ( !isset( $this->arguments['printer'] ) ) {
$this->arguments['printer'] = MediaWikiPHPUnitResultPrinter::class;
}
}
public function publicShowHelp() {
parent::showHelp();
}
}