From 5b3765f7b519b77c64ad11d7b6e2d14d258364b5 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Thu, 7 Mar 2024 14:56:45 +0300 Subject: [PATCH] Fix ConfirmEdit to avoid global state ConfirmEdit will try to mess with ObjectCache::$instances, clean this up so that we migrate consumers to go through ObjectCacheFactory. Bug: T358346 Change-Id: I317a1a17f4f39e99a9b31660eebcd0185adb88f8 --- tests/phpunit/CaptchaPreAuthenticationProviderTest.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/tests/phpunit/CaptchaPreAuthenticationProviderTest.php b/tests/phpunit/CaptchaPreAuthenticationProviderTest.php index 6bb35084..721f84d7 100644 --- a/tests/phpunit/CaptchaPreAuthenticationProviderTest.php +++ b/tests/phpunit/CaptchaPreAuthenticationProviderTest.php @@ -9,7 +9,6 @@ use MediaWiki\Extension\ConfirmEdit\Hooks; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Extension\ConfirmEdit\Store\CaptchaHashStore; use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore; -use MediaWiki\MediaWikiServices; use MediaWiki\Request\FauxRequest; use MediaWiki\Tests\Unit\Auth\AuthenticationProviderTestTrait; use MediaWiki\User\User; @@ -29,15 +28,10 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiIntegrationTestCase 'wgCaptchaBadLoginAttempts' => 1, 'wgCaptchaBadLoginPerUserAttempts' => 1, 'wgCaptchaStorageClass' => CaptchaHashStore::class, - 'wgMainCacheType' => __METHOD__, + 'wgMainCacheType' => 'hash', ] ); CaptchaStore::unsetInstanceForTests(); CaptchaStore::get()->clearAll(); - $services = MediaWikiServices::getInstance(); - if ( method_exists( $services, 'getLocalClusterObjectCache' ) ) { - $this->setService( 'LocalClusterObjectCache', new HashBagOStuff() ); - } - ObjectCache::$instances[__METHOD__] = new HashBagOStuff(); } public function tearDown(): void {