mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-12-02 17:46:41 +00:00
9de38d445a
Change-Id: I63c4879baa3c03980f11590f1db729e27ce307e4
37 lines
1.3 KiB
PHP
37 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, $provideUser, $expectedReqs ) {
|
|
$username = $provideUser ? $this->getTestSysop()->getUser()->getName() : null;
|
|
|
|
$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, false, [] ],
|
|
[ AuthManager::ACTION_CREATE, false, [] ],
|
|
[ AuthManager::ACTION_CREATE, true, [ new TitleBlacklistAuthenticationRequest() ] ],
|
|
[ AuthManager::ACTION_CHANGE, false, [] ],
|
|
[ AuthManager::ACTION_REMOVE, false, [] ],
|
|
];
|
|
}
|
|
}
|