* (bug 6672, 31024) Fixes for handling of images with an EXIF orientation
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
index e89c442..39cccf8 100755 (executable)
@@ -15,10 +15,34 @@ $IP = dirname( dirname( dirname( __FILE__ ) ) );
 define( 'MW_PHPUNIT_TEST', true );
 
 // Start up MediaWiki in command-line mode
-require_once( "$IP/maintenance/commandLine.inc" );
+require_once( "$IP/maintenance/Maintenance.php" );
 
-// Assume UTC for testing purposes
-$wgLocaltimezone = 'UTC';
+class PHPUnitMaintClass extends Maintenance {
+       public function finalSetup() {
+               parent::finalSetup();
+
+               global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgUseDatabaseMessages;
+               global $wgLocaltimezone, $wgLocalisationCacheConf;
+
+               $wgMainCacheType = CACHE_NONE;
+               $wgMessageCacheType = CACHE_NONE;
+               $wgParserCacheType = CACHE_NONE;
+
+               $wgUseDatabaseMessages = false; # Set for future resets
+
+               // Assume UTC for testing purposes
+               $wgLocaltimezone = 'UTC';
+
+               $wgLocalisationCacheConf['storeClass'] =  'LCStore_Null';
+       }
+       public function execute() { }
+       public function getDbType() {
+               return Maintenance::DB_ADMIN;
+       }
+}
+
+$maintClass = 'PHPUnitMaintClass';
+require( RUN_MAINTENANCE_IF_MAIN );
 
 if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
        //Hack to eliminate the need to use the Makefile (which sucks ATM)
@@ -27,13 +51,10 @@ if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
 }
 
 require_once( 'PHPUnit/Runner/Version.php' );
-if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
-       # PHPUnit 3.5.0 introduced a nice autoloader based on class name
-       require_once( 'PHPUnit/Autoload.php' );
-} else {
-       # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility
-       require_once( 'PHPUnit/TextUI/Command.php' );
+if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '<' ) ) {
+       die( 'PHPUnit 3.5 or later required, you have ' . PHPUnit_Runner_Version::id() . ".\n" );
 }
+require_once( 'PHPUnit/Autoload.php' );
 
 require_once( "$IP/tests/TestsAutoLoader.php" );
 MediaWikiPHPUnitCommand::main();