2016-05-07 11:21:02 +00:00
|
|
|
<?php
|
2019-06-05 16:27:36 +00:00
|
|
|
|
2016-05-07 11:21:02 +00:00
|
|
|
use MediaWiki\Auth\AuthManager;
|
2021-05-07 12:33:56 +00:00
|
|
|
use MediaWiki\Tests\Unit\Auth\AuthenticationProviderTestTrait;
|
2016-05-07 11:21:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @group Database
|
2018-02-16 08:01:34 +00:00
|
|
|
* @covers TitleBlacklistPreAuthenticationProvider
|
2016-05-07 11:21:02 +00:00
|
|
|
*/
|
2021-05-07 12:33:56 +00:00
|
|
|
class TitleBlacklistPreAuthenticationProviderTest extends MediaWikiIntegrationTestCase {
|
|
|
|
use AuthenticationProviderTestTrait;
|
|
|
|
|
2016-05-07 11:21:02 +00:00
|
|
|
/**
|
|
|
|
* @dataProvider provideGetAuthenticationRequests
|
|
|
|
*/
|
|
|
|
public function testGetAuthenticationRequests( $action, $username, $expectedReqs ) {
|
|
|
|
$provider = new TitleBlacklistPreAuthenticationProvider();
|
2021-05-07 12:33:56 +00:00
|
|
|
$this->initProvider( $provider, null, null, $this->getServiceContainer()->getAuthManager() );
|
2016-05-07 11:21:02 +00:00
|
|
|
$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, [] ],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|