mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-12-03 10:07:41 +00:00
d01b9a933c
Initally used a new sniff with autofix (T333745) Bug: T332865 Change-Id: I6941b43f599063864de59bd7906beb082278fdea
35 lines
1.3 KiB
PHP
35 lines
1.3 KiB
PHP
<?php
|
|
|
|
use MediaWiki\Auth\AuthManager;
|
|
use MediaWiki\Extension\TitleBlacklist\TitleBlacklistAuthenticationRequest;
|
|
use MediaWiki\Extension\TitleBlacklist\TitleBlacklistPreAuthenticationProvider;
|
|
use MediaWiki\Tests\Unit\Auth\AuthenticationProviderTestTrait;
|
|
|
|
/**
|
|
* @group Database
|
|
* @covers \MediaWiki\Extension\TitleBlacklist\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 static 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, [] ],
|
|
];
|
|
}
|
|
}
|