Tidy up some unused variables and such
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
1 #!/usr/bin/env php
2 <?php
3 /**
4 * Bootstrapping for MediaWiki PHPUnit tests
5 *
6 * @file
7 */
8
9 /* Configuration */
10
11 // Evaluate the include path relative to this file
12 $IP = dirname( dirname( dirname( __FILE__ ) ) );
13
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 );
16
17 // Start up MediaWiki in command-line mode
18 require_once( "$IP/maintenance/Maintenance.php" );
19
20 class PHPUnitMaintClass extends Maintenance {
21 public function finalSetup() {
22 parent::finalSetup();
23
24 global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages;
25
26 $wgMainCacheType = CACHE_NONE;
27 $wgMessageCacheType = CACHE_NONE;
28 $wgParserCacheType = CACHE_NONE;
29 $wgUseDatabaseMessages = false; # Set for future resets
30 }
31 public function execute() { }
32 public function getDbType() {
33 return Maintenance::DB_ADMIN;
34 }
35 }
36
37 $maintClass = 'PHPUnitMaintClass';
38 require( RUN_MAINTENANCE_IF_MAIN );
39
40 // Assume UTC for testing purposes
41 $wgLocaltimezone = 'UTC';
42
43 $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
44
45 if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
46 //Hack to eliminate the need to use the Makefile (which sucks ATM)
47 $_SERVER['argv'][] = '--configuration';
48 $_SERVER['argv'][] = $IP . '/tests/phpunit/suite.xml';
49 }
50
51 require_once( 'PHPUnit/Runner/Version.php' );
52 if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
53 # PHPUnit 3.5.0 introduced a nice autoloader based on class name
54 require_once( 'PHPUnit/Autoload.php' );
55 } else {
56 # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility
57 require_once( 'PHPUnit/TextUI/Command.php' );
58 }
59
60 require_once( "$IP/tests/TestsAutoLoader.php" );
61 MediaWikiPHPUnitCommand::main();
62