wiki.techinc.nl/tests/phpunit/bootstrap.php
addshore 9d69b15958 Move profile In/OUT call out of MWPHPUnitCommand
Change-Id: I710fddc20e88745c9091432dff87b5e361c1f71a
2014-05-05 12:55:56 +00:00

36 lines
844 B
PHP

<?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 __construct() {
wfProfileIn( __CLASS__ );
}
public function __destruct() {
wfProfileOut( __CLASS__ );
// 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();