From 935b0852eb55de49de171eb3ac956e52f1f51b55 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sun, 28 Apr 2019 20:41:17 +0100 Subject: [PATCH] Avoid usage of deprecated wfGetMainCache() function This function was deprecated in 1.32 and replaced with the use of ObjectCache::getLocalClusterInstance(). Change-Id: Id50700a6a7110888b12c4ee1a2100134173760a0 --- tests/phpunit/includes/site/CachingSiteStoreTest.php | 12 ++++++++---- tests/phpunit/suites/UploadFromUrlTestSuite.php | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/includes/site/CachingSiteStoreTest.php b/tests/phpunit/includes/site/CachingSiteStoreTest.php index 0fdcf6dab2..f04d35ca02 100644 --- a/tests/phpunit/includes/site/CachingSiteStoreTest.php +++ b/tests/phpunit/includes/site/CachingSiteStoreTest.php @@ -37,7 +37,7 @@ class CachingSiteStoreTest extends MediaWikiTestCase { $store = new CachingSiteStore( $this->getHashSiteStore( $testSites ), - wfGetMainCache() + ObjectCache::getLocalClusterInstance() ); $sites = $store->getSites(); @@ -62,7 +62,9 @@ class CachingSiteStoreTest extends MediaWikiTestCase { * @covers CachingSiteStore::saveSites */ public function testSaveSites() { - $store = new CachingSiteStore( new HashSiteStore(), wfGetMainCache() ); + $store = new CachingSiteStore( + new HashSiteStore(), ObjectCache::getLocalClusterInstance() + ); $sites = []; @@ -108,7 +110,7 @@ class CachingSiteStoreTest extends MediaWikiTestCase { return $siteList; } ) ); - $store = new CachingSiteStore( $dbSiteStore, wfGetMainCache() ); + $store = new CachingSiteStore( $dbSiteStore, ObjectCache::getLocalClusterInstance() ); // initialize internal cache $this->assertGreaterThan( 0, $store->getSites()->count(), 'count sites' ); @@ -138,7 +140,9 @@ class CachingSiteStoreTest extends MediaWikiTestCase { * @covers CachingSiteStore::clear */ public function testClear() { - $store = new CachingSiteStore( new HashSiteStore(), wfGetMainCache() ); + $store = new CachingSiteStore( + new HashSiteStore(), ObjectCache::getLocalClusterInstance() + ); $this->assertTrue( $store->clear() ); $site = $store->getSite( 'enwiki' ); diff --git a/tests/phpunit/suites/UploadFromUrlTestSuite.php b/tests/phpunit/suites/UploadFromUrlTestSuite.php index 00d607f99a..3b6d6f219b 100644 --- a/tests/phpunit/suites/UploadFromUrlTestSuite.php +++ b/tests/phpunit/suites/UploadFromUrlTestSuite.php @@ -57,7 +57,7 @@ class UploadFromUrlTestSuite extends PHPUnit_Framework_TestSuite { $wgParserCacheType = CACHE_NONE; DeferredUpdates::clearPendingUpdates(); - $wgMemc = wfGetMainCache(); + $wgMemc = ObjectCache::getLocalClusterInstance(); $messageMemc = wfGetMessageCacheStorage(); RequestContext::resetMain(); -- 2.20.1