mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-27 17:40:11 +00:00
Use MediaWikiServices::getAuthManager
This required MediaWiki 1.35 (already set in extension.json) Change-Id: Ic640f25b299dd7be429766f028ec91ab9481c85c
This commit is contained in:
parent
1c9c00b507
commit
76ff299d8c
|
@ -2,6 +2,7 @@
|
|||
|
||||
use MediaWiki\Auth\AuthManager;
|
||||
use MediaWiki\Auth\UsernameAuthenticationRequest;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\TestingAccessWrapper;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
$request->setCookie( 'UserName', $username );
|
||||
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
$reqs = $provider->getAuthenticationRequests( $action, [ 'username' => $username ] );
|
||||
if ( $needsCaptcha ) {
|
||||
$this->assertCount( 1, $reqs );
|
||||
|
@ -82,7 +83,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
$this->setTriggers( [ 'createaccount' ] );
|
||||
$captcha = new SimpleCaptcha();
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
|
||||
$reqs = $provider->getAuthenticationRequests( AuthManager::ACTION_CREATE,
|
||||
[ 'username' => 'Foo' ] );
|
||||
|
@ -116,7 +117,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
$this->setMwGlobals( 'wgCaptcha', $captcha );
|
||||
TestingAccessWrapper::newFromClass( ConfirmEditHooks::class )->instanceCreated = true;
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
|
||||
$status = $provider->testForAuthentication( $req ? [ $req ] : [] );
|
||||
$this->assertEquals( $result, $status->isGood() );
|
||||
|
@ -149,7 +150,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
CaptchaStore::get()->store( '345', [ 'question' => '2+2', 'answer' => '4' ] );
|
||||
$user = User::newFromName( 'Foo' );
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
|
||||
$status = $provider->testForAccountCreation( $user, $creator, $req ? [ $req ] : [] );
|
||||
$this->assertEquals( $result, $status->isGood() );
|
||||
|
@ -175,7 +176,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
$user = User::newFromName( 'Foo' );
|
||||
$anotherUser = User::newFromName( 'Bar' );
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
|
||||
$this->assertFalse( $captcha->isBadLoginTriggered() );
|
||||
$this->assertFalse( $captcha->isBadLoginPerUserTriggered( $user ) );
|
||||
|
@ -197,7 +198,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
$captcha = new SimpleCaptcha();
|
||||
$user = User::newFromName( 'Foo' );
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
|
||||
$this->assertFalse( $captcha->isBadLoginTriggered() );
|
||||
$this->assertFalse( $captcha->isBadLoginPerUserTriggered( $user ) );
|
||||
|
@ -222,7 +223,7 @@ class CaptchaPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|||
]
|
||||
);
|
||||
$provider = new CaptchaPreAuthenticationProvider();
|
||||
$provider->setManager( AuthManager::singleton() );
|
||||
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
|
||||
$providerAccess = TestingAccessWrapper::newFromObject( $provider );
|
||||
|
||||
$disablePingLimiter = false;
|
||||
|
|
Loading…
Reference in a new issue