aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/MediaWikiPHPUnitCommand.php
blob: 6c0db97936401ce836e9b7696be6a852def7e562 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?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();
	}
}