]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - tests/phpunit/bootstrap.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / tests / phpunit / bootstrap.php
diff --git a/tests/phpunit/bootstrap.php b/tests/phpunit/bootstrap.php
new file mode 100644 (file)
index 0000000..a5c8ef6
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Bootstrapping for MediaWiki PHPUnit tests
+ * This file is included by phpunit and is NOT in the global scope.
+ *
+ * @file
+ */
+
+if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
+       echo <<<EOF
+You are running these tests directly from phpunit. You may not have all globals correctly set.
+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();