Merge "Add new grammar forms for language names in Russian"
[lhc/web/wiklou.git] / tests / phpunit / phpunit.php
index 587d6d0..49b91c3 100755 (executable)
@@ -42,14 +42,28 @@ class PHPUnitMaintClass extends Maintenance {
                        false, # not required
                        false # no arg needed
                );
-               $this->addOption( 'regex', 'Only run parser tests that match the given regex.', false, true );
+               $this->addOption(
+                       'regex',
+                       'Only run parser tests that match the given regex.',
+                       false,
+                       true
+               );
                $this->addOption( 'file', 'File describing parser tests.', false, true );
                $this->addOption( 'use-filebackend', 'Use filebackend', false, true );
                $this->addOption( 'use-bagostuff', 'Use bagostuff', false, true );
                $this->addOption( 'use-jobqueue', 'Use jobqueue', false, true );
-               $this->addOption( 'keep-uploads', 'Re-use the same upload directory for each test, don\'t delete it.', false, false );
+               $this->addOption(
+                       'keep-uploads',
+                       'Re-use the same upload directory for each test, don\'t delete it.',
+                       false,
+                       false
+               );
                $this->addOption( 'use-normal-tables', 'Use normal DB tables.', false, false );
-               $this->addOption( 'reuse-db', 'Init DB only if tables are missing and keep after finish.', false, false );
+               $this->addOption(
+                       'reuse-db', 'Init DB only if tables are missing and keep after finish.',
+                       false,
+                       false
+               );
        }
 
        public function finalSetup() {
@@ -66,11 +80,21 @@ class PHPUnitMaintClass extends Maintenance {
                // wfWarn should cause tests to fail
                $wgDevelopmentWarnings = true;
 
+               // Make sure all caches and stashes are either disabled or use
+               // in-process cache only to prevent tests from using any preconfigured
+               // cache meant for the local wiki from outside the test run.
+               // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC.
+
+               // Disabled in DefaultSettings, override local settings
+               $wgMainWANCache =
                $wgMainCacheType = CACHE_NONE;
-               $wgMainWANCache = CACHE_NONE;
-               $wgMessageCacheType = CACHE_NONE;
-               $wgParserCacheType = CACHE_NONE;
-               $wgLanguageConverterCacheType = CACHE_NONE;
+               // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db
+               $wgMessageCacheType =
+               $wgParserCacheType =
+               $wgSessionCacheType =
+               $wgLanguageConverterCacheType = 'hash';
+               // Uses db-replicated in DefaultSettings
+               $wgMainStash = 'hash';
 
                $wgUseDatabaseMessages = false; # Set for future resets
 
@@ -104,7 +128,7 @@ class PHPUnitMaintClass extends Maintenance {
 
                # Make sure we have --configuration or PHPUnit might complain
                if ( !in_array( '--configuration', $_SERVER['argv'] ) ) {
-                       //Hack to eliminate the need to use the Makefile (which sucks ATM)
+                       // Hack to eliminate the need to use the Makefile (which sucks ATM)
                        array_splice( $_SERVER['argv'], 1, 0,
                                array( '--configuration', $IP . '/tests/phpunit/suite.xml' ) );
                }