92eeffa2575a54c33ffd0dc67342ebd729081ac1
4 * Bootstrapping for MediaWiki PHPUnit tests
11 // Evaluate the include path relative to this file
12 $IP = dirname( dirname( dirname( __FILE__
) ) );
14 // Set a flag which can be used to detect when other scripts have been entered through this entry point or not
15 define( 'MW_PHPUNIT_TEST', true );
17 // Start up MediaWiki in command-line mode
18 require_once( "$IP/maintenance/Maintenance.php" );
20 class PHPUnitMaintClass
extends Maintenance
{
21 public function finalSetup() {
24 global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages;
25 global $wgLocaltimezone, $wgLocalisationCacheConf;
27 $wgMainCacheType = CACHE_NONE
;
28 $wgMessageCacheType = CACHE_NONE
;
29 $wgParserCacheType = CACHE_NONE
;
31 $wgUseDatabaseMessages = false; # Set for future resets
33 // Assume UTC for testing purposes
34 $wgLocaltimezone = 'UTC';
36 $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
38 public function execute() { }
39 public function getDbType() {
40 return Maintenance
::DB_ADMIN
;
44 $maintClass = 'PHPUnitMaintClass';
45 require( RUN_MAINTENANCE_IF_MAIN
);
47 if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
48 //Hack to eliminate the need to use the Makefile (which sucks ATM)
49 array_splice( $_SERVER['argv'], 1, 0,
50 array( '--configuration', $IP . '/tests/phpunit/suite.xml' ) );
53 require_once( 'PHPUnit/Runner/Version.php' );
54 if( version_compare( PHPUnit_Runner_Version
::id(), '3.5.0', '<' ) ) {
55 die( 'PHPUnit 3.5 or later required, you have ' . PHPUnit_Runner_Version
::id() . ".\n" );
57 require_once( 'PHPUnit/Autoload.php' );
59 require_once( "$IP/tests/TestsAutoLoader.php" );
60 MediaWikiPHPUnitCommand
::main();