Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / includes / auth / AbstractPreAuthenticationProviderTest.php
blob963845183d4879efb9719ab1730eb4ac375ed2a2
1 <?php
3 namespace MediaWiki\Auth;
5 /**
6 * @group AuthManager
7 * @covers MediaWiki\Auth\AbstractPreAuthenticationProvider
8 */
9 class AbstractPreAuthenticationProviderTest extends \MediaWikiTestCase {
10 public function testAbstractPreAuthenticationProvider() {
11 $user = \User::newFromName( 'UTSysop' );
13 $provider = $this->getMockForAbstractClass( AbstractPreAuthenticationProvider::class );
15 $this->assertEquals(
16 [],
17 $provider->getAuthenticationRequests( AuthManager::ACTION_LOGIN, [] )
19 $this->assertEquals(
20 \StatusValue::newGood(),
21 $provider->testForAuthentication( [] )
23 $this->assertEquals(
24 \StatusValue::newGood(),
25 $provider->testForAccountCreation( $user, $user, [] )
27 $this->assertEquals(
28 \StatusValue::newGood(),
29 $provider->testUserForCreation( $user, AuthManager::AUTOCREATE_SOURCE_SESSION )
31 $this->assertEquals(
32 \StatusValue::newGood(),
33 $provider->testUserForCreation( $user, false )
35 $this->assertEquals(
36 \StatusValue::newGood(),
37 $provider->testForAccountLink( $user )
40 $res = AuthenticationResponse::newPass();
41 $provider->postAuthentication( $user, $res );
42 $provider->postAccountCreation( $user, $user, $res );
43 $provider->postAccountLink( $user, $res );