Move teardownTestDB and wfLogProfilingData out of MWPHPUnitCommand
authoraddshore <addshorewiki@gmail.com>
Mon, 5 May 2014 12:43:00 +0000 (13:43 +0100)
committeraddshore <addshorewiki@gmail.com>
Mon, 5 May 2014 12:55:42 +0000 (13:55 +0100)
Change-Id: Ic175c1457e7f76a2b5232a2b5d3563c5982cfee2

tests/phpunit/MediaWikiPHPUnitCommand.php
tests/phpunit/bootstrap.php

index bac9f4d..9f24835 100644 (file)
@@ -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 {
index d929b79..573a91a 100644 (file)
@@ -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();