Replace uses of the deprecated setters of AbstractAuthenticationProvider

Since AbstractAuthenticationProvider ::setLogger, ::setManager,
::setConfig, ::setHookContainer methods had been soft deprecated,
so its usages were removed. AuthenticationProviderTestTrait
::initProvider was used in order to initialize
TitleBlacklistPreAuthenticationProvider in the test.
* Also bump required MW version to 1.37.0

Bug: T281994
Change-Id: I15b811a8596addad7a50b13d978851ebd86da9a5
This commit is contained in:
vladshapik 2021-05-07 15:33:56 +03:00 committed by Vlad.shapik
parent 942ff96c7f
commit 3025d83afc
2 changed files with 6 additions and 4 deletions

View file

@ -10,7 +10,7 @@
"license-name": "GPL-2.0-or-later",
"type": "antispam",
"requires": {
"MediaWiki": ">= 1.35.0"
"MediaWiki": ">= 1.37.0"
},
"GroupPermissions": {
"sysop": {

View file

@ -1,19 +1,21 @@
<?php
use MediaWiki\Auth\AuthManager;
use MediaWiki\MediaWikiServices;
use MediaWiki\Tests\Unit\Auth\AuthenticationProviderTestTrait;
/**
* @group Database
* @covers TitleBlacklistPreAuthenticationProvider
*/
class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiTestCase {
class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiIntegrationTestCase {
use AuthenticationProviderTestTrait;
/**
* @dataProvider provideGetAuthenticationRequests
*/
public function testGetAuthenticationRequests( $action, $username, $expectedReqs ) {
$provider = new TitleBlacklistPreAuthenticationProvider();
$provider->setManager( MediaWikiServices::getInstance()->getAuthManager() );
$this->initProvider( $provider, null, null, $this->getServiceContainer()->getAuthManager() );
$reqs = $provider->getAuthenticationRequests( $action, [ 'username' => $username ] );
$this->assertEquals( $expectedReqs, $reqs );
}