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
;
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 );
24 $provider->getAuthenticationRequests( AuthManager
::ACTION_LOGIN
, [] )
27 StatusValue
::newGood(),
28 $provider->testForAuthentication( [] )
31 StatusValue
::newGood(),
32 $provider->testForAccountCreation( $user, $user, [] )
35 StatusValue
::newGood(),
36 $provider->testUserForCreation( $user, AuthManager
::AUTOCREATE_SOURCE_SESSION
)
39 StatusValue
::newGood(),
40 $provider->testUserForCreation( $user, false )
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 );