mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-12 00:38:42 +00:00
3025d83afc
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
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Auth\AuthManager;
|
|
use MediaWiki\Tests\Unit\Auth\AuthenticationProviderTestTrait;
|
|
|
|
/**
|
|
* @group Database
|
|
* @covers TitleBlacklistPreAuthenticationProvider
|
|
*/
|
|
class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiIntegrationTestCase {
|
|
use AuthenticationProviderTestTrait;
|
|
|
|
/**
|
|
* @dataProvider provideGetAuthenticationRequests
|
|
*/
|
|
public function testGetAuthenticationRequests( $action, $username, $expectedReqs ) {
|
|
$provider = new TitleBlacklistPreAuthenticationProvider();
|
|
$this->initProvider( $provider, null, null, $this->getServiceContainer()->getAuthManager() );
|
|
$reqs = $provider->getAuthenticationRequests( $action, [ 'username' => $username ] );
|
|
$this->assertEquals( $expectedReqs, $reqs );
|
|
}
|
|
|
|
public function provideGetAuthenticationRequests() {
|
|
return [
|
|
[ AuthManager::ACTION_LOGIN, null, [] ],
|
|
[ AuthManager::ACTION_CREATE, null, [] ],
|
|
[ AuthManager::ACTION_CREATE, 'UTSysop', [ new TitleBlacklistAuthenticationRequest() ] ],
|
|
[ AuthManager::ACTION_CHANGE, null, [] ],
|
|
[ AuthManager::ACTION_REMOVE, null, [] ],
|
|
];
|
|
}
|
|
}
|