From: addshore Date: Mon, 5 May 2014 12:43:00 +0000 (+0100) Subject: Move teardownTestDB and wfLogProfilingData out of MWPHPUnitCommand X-Git-Tag: 1.31.0-rc.0~15868^2~1 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=159dc79049e4f0b45883d739eecbd93baf69001b;p=lhc%2Fweb%2Fwiklou.git Move teardownTestDB and wfLogProfilingData out of MWPHPUnitCommand Change-Id: Ic175c1457e7f76a2b5232a2b5d3563c5982cfee2 --- diff --git a/tests/phpunit/MediaWikiPHPUnitCommand.php b/tests/phpunit/MediaWikiPHPUnitCommand.php index bac9f4dadd..9f24835c2c 100644 --- a/tests/phpunit/MediaWikiPHPUnitCommand.php +++ b/tests/phpunit/MediaWikiPHPUnitCommand.php @@ -59,12 +59,6 @@ class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command { wfProfileOut( __METHOD__ ); - // Return to real wiki db, so profiling data is preserved - MediaWikiTestCase::teardownTestDB(); - - // Log profiling data, e.g. in the database or UDP - wfLogProfilingData(); - if ( $exit ) { exit( $ret ); } else { diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php index d929b79d1e..573a91a03d 100644 --- a/tests/phpunit/bootstrap.php +++ b/tests/phpunit/bootstrap.php @@ -13,3 +13,18 @@ Running phpunit.php instead is recommended. EOF; require_once __DIR__ . "/phpunit.php"; } + +class MediaWikiPHPUnitBootstrap { + + public function __destruct() { + // Return to real wiki db, so profiling data is preserved + MediaWikiTestCase::teardownTestDB(); + + // Log profiling data, e.g. in the database or UDP + wfLogProfilingData(); + } + +} + +// This will be destructed after all tests have been run +$mediawikiPHPUnitBootstrap = new MediaWikiPHPUnitBootstrap();