From: Timo Tijhof Date: Thu, 24 Sep 2015 12:23:15 +0000 (+0100) Subject: phpunit: Replace APC with HashBagOStuff during a test X-Git-Tag: 1.31.0-rc.0~9845^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=0d9a48a4c386529e2f249d5948181725d7f373e3;p=lhc%2Fweb%2Fwiklou.git phpunit: Replace APC with HashBagOStuff during a test * Ensures values don't survive the unit test run. * Ensures a clean state for each test. Change-Id: I94e1ac14096fb4c4071fe9960d9465e60f27a89d --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 7dc7027afb..49c7ad309e 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -103,6 +103,12 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { */ ObjectCache::$instances[CACHE_DB] = new HashBagOStuff; + // Sandbox APC by replacing with in-process hash cache instead. + // Ensures tests are removed between tests. + ObjectCache::$instances['apc'] = + ObjectCache::$instances['xcache'] = + ObjectCache::$instances['wincache'] = new HashBagOStuff; + $needsResetDB = false; if ( $this->needsDB() ) {