From: daniel Date: Sat, 9 Jun 2012 11:03:59 +0000 (+0200) Subject: nicer phpunit X-Git-Tag: 1.31.0-rc.0~22097^2^2~124 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=27034de273d0ab7ddd40dd624c5aecd0da134031;p=lhc%2Fweb%2Fwiklou.git nicer phpunit --- diff --git a/tests/phpunit/MediaWikiPHPUnitCommand.php b/tests/phpunit/MediaWikiPHPUnitCommand.php index ea385ad9b2..18475cac8c 100644 --- a/tests/phpunit/MediaWikiPHPUnitCommand.php +++ b/tests/phpunit/MediaWikiPHPUnitCommand.php @@ -53,6 +53,19 @@ class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command { } } + protected function handleCustomTestSuite() { + if ( empty( $this->arguments['printer'] ) ) { + $this->arguments['printer'] = new PHPUnit_TextUI_ResultPrinter( + null, + isset($this->arguments['verbose']) ? $this->arguments['verbose'] : false, + isset($this->arguments['colors']) ? $this->arguments['colors'] : true, + isset($this->arguments['debug']) ? $this->arguments['debug'] : false + ); + } + + parent::handleCustomTestSuite(); + } + public function showHelp() { parent::showHelp(); @@ -74,3 +87,30 @@ EOT; } } + +class MediaWikiPHPUnitResultPrinter extends PHPUnit_TextUI_ResultPrinter { + /** + * Overrides original method to ignore incomplete tests except in verbose mode. + * + * @param PHPUnit_Framework_TestResult $result + */ + protected function printIncompletes(PHPUnit_Framework_TestResult $result) + { + if ( $this->verbose ) { + parent::printIncompletes( $result ); + } + } + + /** + * Overrides original method to ignore skipped tests except in verbose mode. + * + * @param PHPUnit_Framework_TestResult $result + */ + protected function printSkipped(PHPUnit_Framework_TestResult $result) + { + if ( $this->verbose ) { + parent::printSkipped( $result ); + } + } + +}