From 1cf32cf03679582fd38624edede17e0dd236ebb4 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 4 Sep 2016 11:10:27 -0700 Subject: [PATCH] Reset the LocalClusterObjectCache service in tests Change-Id: I0886e749dee19d729bcd4f398d65b78aa22a8065 --- tests/phpunit/CaptchaPreAuthenticationProviderTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/CaptchaPreAuthenticationProviderTest.php b/tests/phpunit/CaptchaPreAuthenticationProviderTest.php index 334393ef2..3dcc63d65 100644 --- a/tests/phpunit/CaptchaPreAuthenticationProviderTest.php +++ b/tests/phpunit/CaptchaPreAuthenticationProviderTest.php @@ -23,7 +23,12 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase { ] ); CaptchaStore::unsetInstanceForTests(); CaptchaStore::get()->clearAll(); - ObjectCache::$instances[__METHOD__] = new HashBagOStuff(); + $services = \MediaWiki\MediaWikiServices::getInstance(); + if ( method_exists( $services, 'getLocalClusterObjectCache' ) ) { + $this->setService( 'LocalClusterObjectCache', new HashBagOStuff() ); + } else { + ObjectCache::$instances[__METHOD__] = new HashBagOStuff(); + } } public function tearDown() {