aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/objectcache/ObjectCacheTest.php
diff options
context:
space:
mode:
authorDerick Alangi <alangiderick@gmail.com>2022-07-28 21:36:55 +0100
committerDerick Alangi <alangiderick@gmail.com>2022-08-01 06:16:22 +0100
commit175832a8e94afe49c8ba54e8ac8325150fcc35cd (patch)
tree2a28319fdbd52b32cdad8f75fe6769649fe4571a /tests/phpunit/includes/objectcache/ObjectCacheTest.php
parentd186758b5de1422d18cf8c9b7511d1ccbf5a1284 (diff)
downloadmediawikicore-175832a8e94afe49c8ba54e8ac8325150fcc35cd.tar.gz
mediawikicore-175832a8e94afe49c8ba54e8ac8325150fcc35cd.zip
Migrate usage of `setMwGlobals()` to `overrideConfigValue(s)`
Change-Id: I49d97864d8f9d8cadf01b0c0dc653fbac4ca9e94
Diffstat (limited to 'tests/phpunit/includes/objectcache/ObjectCacheTest.php')
-rw-r--r--tests/phpunit/includes/objectcache/ObjectCacheTest.php28
1 files changed, 11 insertions, 17 deletions
diff --git a/tests/phpunit/includes/objectcache/ObjectCacheTest.php b/tests/phpunit/includes/objectcache/ObjectCacheTest.php
index a1cee9f89b49..38de1fa73104 100644
--- a/tests/phpunit/includes/objectcache/ObjectCacheTest.php
+++ b/tests/phpunit/includes/objectcache/ObjectCacheTest.php
@@ -1,5 +1,7 @@
<?php
+use MediaWiki\MainConfigNames;
+
class ObjectCacheTest extends MediaWikiIntegrationTestCase {
protected function setUp(): void {
@@ -7,10 +9,10 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
parent::setUp();
$this->setCacheConfig();
- $this->setMwGlobals( [
- 'wgMainCacheType' => CACHE_NONE,
- 'wgMessageCacheType' => CACHE_NONE,
- 'wgParserCacheType' => CACHE_NONE,
+ $this->setMainCache( CACHE_NONE );
+ $this->overrideConfigValues( [
+ MainConfigNames::MessageCacheType => CACHE_NONE,
+ MainConfigNames::ParserCacheType => CACHE_NONE,
] );
}
@@ -24,7 +26,7 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
CACHE_ACCEL => [ 'class' => HashBagOStuff::class ],
'hash' => [ 'class' => HashBagOStuff::class ],
];
- $this->setMwGlobals( 'wgObjectCaches', $arr + $defaults );
+ $this->overrideConfigValue( MainConfigNames::ObjectCaches, $arr + $defaults );
}
/** @covers ObjectCache::newAnything */
@@ -38,9 +40,7 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
/** @covers ObjectCache::newAnything */
public function testNewAnythingHash() {
- $this->setMwGlobals( [
- 'wgMainCacheType' => 'hash'
- ] );
+ $this->setMainCache( CACHE_HASH );
$this->assertInstanceOf(
HashBagOStuff::class,
@@ -51,9 +51,7 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
/** @covers ObjectCache::newAnything */
public function testNewAnythingAccel() {
- $this->setMwGlobals( [
- 'wgMainCacheType' => CACHE_ACCEL
- ] );
+ $this->setMainCache( CACHE_ACCEL );
$this->assertInstanceOf(
HashBagOStuff::class,
@@ -64,9 +62,7 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
/** @covers ObjectCache::newAnything */
public function testNewAnythingNoAccel() {
- $this->setMwGlobals( [
- 'wgMainCacheType' => CACHE_ACCEL
- ] );
+ $this->setMainCache( CACHE_ACCEL );
$this->setCacheConfig( [
// Mock APC not being installed (T160519, T147161)
@@ -82,9 +78,7 @@ class ObjectCacheTest extends MediaWikiIntegrationTestCase {
/** @covers ObjectCache::newAnything */
public function testNewAnythingNoAccelNoDb() {
- $this->setMwGlobals( [
- 'wgMainCacheType' => CACHE_ACCEL
- ] );
+ $this->setMainCache( CACHE_ACCEL );
$this->setCacheConfig( [
// Mock APC not being installed (T160519, T147161)