Merge "Fix ConfirmEdit to avoid global state"

This commit is contained in:
jenkins-bot 2024-03-08 16:36:47 +00:00 committed by Gerrit Code Review
commit 6588e7c57e

View file

@ -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 {