wiki.techinc.nl/tests/phpunit/MediaWikiPHPUnitCommand.php
Daimona Eaytoy 86c0a64e91 Use PHPUnit hooks for augmented logs
The TestListener interface is deprecated. This replacement has the
downside of using a public static property, but there seems to be no
other way to pass extra data to the printer (BTW: the ResultPrinter
class is internal, so it'd be even better if we could avoid subclassing
it).

Bug: T243600
Change-Id: I083146b7336ac09dfd077c8e6817553738282662
2020-09-22 11:28:10 +00:00

28 lines
780 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;
// 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();
}
}