Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/240965

Change subject: phpunit: Set $wgMainStash with 'hash' during test execution
......................................................................

phpunit: Set $wgMainStash with 'hash' during test execution

Also clean up the other cache settings to match their order
as defined in DefaultSettings.php.

Don't disable MessageCacheType, ParserCacheType etc. This could
prevent bugs from happening during tests. They are enabled by default
in MediaWiki with CACHE_ANYTHING. At least let them use 'hash'
during tests to resemble a more realistic environment.

Change-Id: Id9edf33c600db3ac4d837e1674a8eb2f5363a4f8
---
M tests/phpunit/MediaWikiTestCase.php
M tests/phpunit/phpunit.php
2 files changed, 16 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/240965/1

diff --git a/tests/phpunit/MediaWikiTestCase.php 
b/tests/phpunit/MediaWikiTestCase.php
index 73c4066..bd30397 100644
--- a/tests/phpunit/MediaWikiTestCase.php
+++ b/tests/phpunit/MediaWikiTestCase.php
@@ -103,8 +103,8 @@
                 */
                ObjectCache::$instances[CACHE_DB] = new HashBagOStuff;
 
-               // Sandbox APC by replacing with in-process hash cache instead.
-               // Ensures tests are removed between tests.
+               // Sandbox APC by replacing with in-process hash instead.
+               // Ensures values are removed between tests.
                ObjectCache::$instances['apc'] =
                ObjectCache::$instances['xcache'] =
                ObjectCache::$instances['wincache'] = new HashBagOStuff;
diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php
index 587d6d0..af924a0 100755
--- a/tests/phpunit/phpunit.php
+++ b/tests/phpunit/phpunit.php
@@ -66,11 +66,21 @@
                // 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
 

-- 
To view, visit https://gerrit.wikimedia.org/r/240965
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9edf33c600db3ac4d837e1674a8eb2f5363a4f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to