X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiPHPUnitCommand.php;h=473e6413b7722a4ce65a8cfd5770913f74c88b4a;hb=34a65359cca7e6afe7480494973e3bbd853c7b19;hp=18475cac8c915368c483a1404f3a6d9f717dedea;hpb=d48ec4aa28cf5ae37d078421181b0c3223ae41ff;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiPHPUnitCommand.php b/tests/phpunit/MediaWikiPHPUnitCommand.php index 18475cac8c..473e6413b7 100644 --- a/tests/phpunit/MediaWikiPHPUnitCommand.php +++ b/tests/phpunit/MediaWikiPHPUnitCommand.php @@ -37,7 +37,7 @@ class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command { # PHPUnit uses stream_resolve_include_path() internally # See bug 32022 set_include_path( - dirname( __FILE__ ) + __DIR__ .PATH_SEPARATOR . get_include_path() ); @@ -53,17 +53,20 @@ 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 - ); - } + public function run( array $argv, $exit = true ) { + $ret = parent::run( $argv, false ); + + // Return to real wiki db, so profiling data is preserved + MediaWikiTestCase::teardownTestDB(); + + // Log profiling data, e.g. in the database or UDP + wfLogProfilingData(); - parent::handleCustomTestSuite(); + if ( $exit ) { + exit( $ret ); + } else { + return $ret; + } } public function showHelp() { @@ -87,30 +90,3 @@ 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 ); - } - } - -}