wiki.techinc.nl/tests/phpunit/MediaWikiPHPUnitCommand.php
Aryeh Gregor 383a925f68 Output only to stderr in unit tests
Otherwise, session tests don't work in PHP 7.2 because headers are
already sent: https://bugs.php.net/bug.php?id=75628

Bug: T206476
Change-Id: Ie88db4a61a56b756c6445d2579a2f30da22c3ee8
2018-10-08 21:04:12 +03:00

33 lines
851 B
PHP

<?php
class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command {
private $cliArgs;
public function __construct( $ignorableOptions, $cliArgs ) {
$ignore = function ( $arg ) {
};
foreach ( $ignorableOptions as $option ) {
$this->longOptions[$option] = $ignore;
}
$this->cliArgs = $cliArgs;
}
protected function handleCustomTestSuite() {
// Use our suite.xml
if ( !isset( $this->arguments['configuration'] ) ) {
$this->arguments['configuration'] = __DIR__ . '/suite.xml';
}
// Add our own listener
$this->arguments['listeners'][] = new MediaWikiPHPUnitTestListener;
// Output only to stderr to avoid "Headers already sent" problems
$this->arguments['stderr'] = true;
}
protected function createRunner() {
$runner = new MediaWikiTestRunner;
$runner->setMwCliArgs( $this->cliArgs );
return $runner;
}
}