2015-11-22 20:17:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
2021-03-28 18:57:32 +00:00
|
|
|
namespace MediaWiki\Tests\Unit\Auth;
|
2015-11-22 20:17:00 +00:00
|
|
|
|
2021-03-28 18:57:32 +00:00
|
|
|
use MediaWiki\Auth\AbstractAuthenticationProvider;
|
|
|
|
|
use MediaWiki\Auth\AuthManager;
|
2023-09-20 07:54:42 +00:00
|
|
|
use MediaWiki\Config\HashConfig;
|
2021-04-16 13:17:10 +00:00
|
|
|
use MediaWiki\HookContainer\HookContainer;
|
|
|
|
|
use MediaWiki\User\UserNameUtils;
|
2024-02-16 21:49:35 +00:00
|
|
|
use MediaWikiUnitTestCase;
|
2021-04-16 13:17:10 +00:00
|
|
|
use Psr\Log\LoggerInterface;
|
2017-04-19 19:37:35 +00:00
|
|
|
use Wikimedia\TestingAccessWrapper;
|
|
|
|
|
|
2015-11-22 20:17:00 +00:00
|
|
|
/**
|
|
|
|
|
* @group AuthManager
|
2018-11-01 11:48:52 +00:00
|
|
|
* @covers \MediaWiki\Auth\AbstractAuthenticationProvider
|
2015-11-22 20:17:00 +00:00
|
|
|
*/
|
2024-02-16 21:49:35 +00:00
|
|
|
class AbstractAuthenticationProviderTest extends MediaWikiUnitTestCase {
|
2021-05-13 16:02:38 +00:00
|
|
|
use AuthenticationProviderTestTrait;
|
|
|
|
|
|
2015-11-22 20:17:00 +00:00
|
|
|
public function testAbstractAuthenticationProvider() {
|
|
|
|
|
$provider = $this->getMockForAbstractClass( AbstractAuthenticationProvider::class );
|
2017-04-19 19:37:35 +00:00
|
|
|
$providerPriv = TestingAccessWrapper::newFromObject( $provider );
|
2015-11-22 20:17:00 +00:00
|
|
|
|
2021-04-16 13:17:10 +00:00
|
|
|
// test AbstractAuthenticationProvider::init
|
|
|
|
|
$logger = $this->getMockForAbstractClass( LoggerInterface::class );
|
|
|
|
|
$authManager = $this->createMock( AuthManager::class );
|
|
|
|
|
$hookContainer = $this->createMock( HookContainer::class );
|
2023-03-01 07:14:53 +00:00
|
|
|
$config = new HashConfig();
|
2021-04-16 13:17:10 +00:00
|
|
|
$userNameUtils = $this->createNoOpMock( UserNameUtils::class );
|
2021-05-13 16:02:38 +00:00
|
|
|
$this->initProvider( $provider, $config, $logger, $authManager, $hookContainer, $userNameUtils );
|
2021-04-16 13:17:10 +00:00
|
|
|
$this->assertSame( $logger, $providerPriv->logger );
|
|
|
|
|
$this->assertSame( $authManager, $providerPriv->manager );
|
|
|
|
|
$this->assertSame( $hookContainer, $providerPriv->hookContainer );
|
|
|
|
|
$this->assertSame( $config, $providerPriv->config );
|
|
|
|
|
$this->assertSame( $userNameUtils, $providerPriv->userNameUtils );
|
|
|
|
|
|
|
|
|
|
// test AbstractAuthenticationProvider::getUniqueId
|
2019-12-13 17:44:39 +00:00
|
|
|
$this->assertIsString( $provider->getUniqueId(), 'getUniqueId' );
|
2015-11-22 20:17:00 +00:00
|
|
|
}
|
|
|
|
|
}
|