From 159dc79049e4f0b45883d739eecbd93baf69001b Mon Sep 17 00:00:00 2001 From: addshore Date: Mon, 5 May 2014 13:43:00 +0100 Subject: [PATCH] Move teardownTestDB and wfLogProfilingData out of MWPHPUnitCommand Change-Id: Ic175c1457e7f76a2b5232a2b5d3563c5982cfee2 --- tests/phpunit/MediaWikiPHPUnitCommand.php | 6 ------ tests/phpunit/bootstrap.php | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) 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(); -- 2.20.1