3 class MediaWikiPHPUnitCommand
extends PHPUnit_TextUI_Command
{
7 public function __construct( $ignorableOptions, $cliArgs ) {
8 $ignore = function ( $arg ) {
10 foreach ( $ignorableOptions as $option ) {
11 $this->longOptions
[$option] = $ignore;
13 $this->cliArgs
= $cliArgs;
16 protected function handleCustomTestSuite() {
18 if ( !isset( $this->arguments
['configuration'] ) ) {
19 $this->arguments
['configuration'] = __DIR__
. '/suite.xml';
22 // Add our own listeners
23 $this->arguments
['listeners'][] = new MediaWikiPHPUnitTestListener
;
24 $this->logListener
= new MediaWikiLoggerPHPUnitTestListener
;
25 $this->arguments
['listeners'][] = $this->logListener
;
27 // Output only to stderr to avoid "Headers already sent" problems
28 $this->arguments
['stderr'] = true;
30 // We could create a printer instance and avoid passing the
31 // listener statically, but then we have to recreate the
32 // appropriate arguments handling + defaults.
33 if ( !isset( $this->arguments
['printer'] ) ) {
34 $this->arguments
['printer'] = MediaWikiPHPUnitResultPrinter
::class;
38 protected function createRunner() {
39 MediaWikiPHPUnitResultPrinter
::setLogListener( $this->logListener
);
40 $runner = new MediaWikiTestRunner
;
41 $runner->setMwCliArgs( $this->cliArgs
);