mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-24 14:14:02 +00:00
8b2dd9cae3
Change-Id: Ic1120e726be71f09fa6ebd166d4992ee2c3a3a6b
30 lines
943 B
PHP
30 lines
943 B
PHP
<?php
|
|
|
|
use MediaWiki\Auth\AuthManager;
|
|
|
|
/**
|
|
* @group Database
|
|
* @covers TitleBlacklistPreAuthenticationProvider
|
|
*/
|
|
class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiTestCase {
|
|
/**
|
|
* @dataProvider provideGetAuthenticationRequests
|
|
*/
|
|
public function testGetAuthenticationRequests( $action, $username, $expectedReqs ) {
|
|
$provider = new TitleBlacklistPreAuthenticationProvider();
|
|
$provider->setManager( AuthManager::singleton() );
|
|
$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, [] ],
|
|
];
|
|
}
|
|
}
|