mediawiki-extensions-TitleB.../tests/phpunit/TitleBlacklistPreAuthenticationProviderTest.php
James D. Forrester 277c88d44d Drop support for operation when wgDisableAuthManager is true
This global from MediaWiki was removed in 854a462 in 2016 but we didn't
clean up after it at the time.

Change-Id: I48f5d104e5350bd2ac170afc155015b8060e2ed5
2019-02-09 12:36:25 -08:00

29 lines
942 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, [] ],
];
}
}