2 use MediaWiki\Auth\AuthManager;
7 class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiTestCase {
8 public function setUp() {
9 global $wgDisableAuthManager;
10 if ( !class_exists( AuthManager::class ) || $wgDisableAuthManager ) {
11 $this->markTestSkipped( 'AuthManager is disabled' );
18 * @dataProvider provideGetAuthenticationRequests
20 public function testGetAuthenticationRequests( $action, $username, $expectedReqs ) {
21 $provider = new TitleBlacklistPreAuthenticationProvider();
22 $provider->setManager( AuthManager::singleton() );
23 $reqs = $provider->getAuthenticationRequests( $action, [ 'username' => $username ] );
24 $this->assertEquals( $expectedReqs, $reqs );
27 public function provideGetAuthenticationRequests() {
29 [ AuthManager::ACTION_LOGIN, null, [] ],
30 [ AuthManager::ACTION_CREATE, null, [] ],
31 [ AuthManager::ACTION_CREATE, 'UTSysop', [ new TitleBlacklistAuthenticationRequest() ] ],
32 [ AuthManager::ACTION_CHANGE, null, [] ],
33 [ AuthManager::ACTION_REMOVE, null, [] ],