Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / includes / auth / AbstractPreAuthenticationProviderTest.php
blob46c0825743c46d85c92897908e898e393225cafa
1 <?php
3 namespace MediaWiki\Tests\Auth;
5 use MediaWiki\Auth\AbstractPreAuthenticationProvider;
6 use MediaWiki\Auth\AuthenticationResponse;
7 use MediaWiki\Auth\AuthManager;
8 use MediaWiki\User\User;
9 use MediaWikiIntegrationTestCase;
10 use StatusValue;
12 /**
13 * @group AuthManager
14 * @covers \MediaWiki\Auth\AbstractPreAuthenticationProvider
16 class AbstractPreAuthenticationProviderTest extends MediaWikiIntegrationTestCase {
17 public function testAbstractPreAuthenticationProvider() {
18 $user = $this->createMock( User::class );
20 $provider = $this->getMockForAbstractClass( AbstractPreAuthenticationProvider::class );
22 $this->assertEquals(
23 [],
24 $provider->getAuthenticationRequests( AuthManager::ACTION_LOGIN, [] )
26 $this->assertEquals(
27 StatusValue::newGood(),
28 $provider->testForAuthentication( [] )
30 $this->assertEquals(
31 StatusValue::newGood(),
32 $provider->testForAccountCreation( $user, $user, [] )
34 $this->assertEquals(
35 StatusValue::newGood(),
36 $provider->testUserForCreation( $user, AuthManager::AUTOCREATE_SOURCE_SESSION )
38 $this->assertEquals(
39 StatusValue::newGood(),
40 $provider->testUserForCreation( $user, false )
42 $this->assertEquals(
43 StatusValue::newGood(),
44 $provider->testForAccountLink( $user )
47 $res = AuthenticationResponse::newPass();
48 $provider->postAuthentication( $user, $res );
49 $provider->postAccountCreation( $user, $user, $res );
50 $provider->postAccountLink( $user, $res );