3 namespace MediaWiki\Auth
;
7 * @covers MediaWiki\Auth\AbstractPreAuthenticationProvider
9 class AbstractPreAuthenticationProviderTest
extends \MediaWikiTestCase
{
10 protected function setUp() {
11 global $wgDisableAuthManager;
14 if ( $wgDisableAuthManager ) {
15 $this->markTestSkipped( '$wgDisableAuthManager is set' );
19 public function testAbstractPreAuthenticationProvider() {
20 $user = \User
::newFromName( 'UTSysop' );
22 $provider = $this->getMockForAbstractClass( AbstractPreAuthenticationProvider
::class );
26 $provider->getAuthenticationRequests( AuthManager
::ACTION_LOGIN
, [] )
29 \StatusValue
::newGood(),
30 $provider->testForAuthentication( [] )
33 \StatusValue
::newGood(),
34 $provider->testForAccountCreation( $user, $user, [] )
37 \StatusValue
::newGood(),
38 $provider->testUserForCreation( $user, AuthManager
::AUTOCREATE_SOURCE_SESSION
)
41 \StatusValue
::newGood(),
42 $provider->testUserForCreation( $user, false )
45 \StatusValue
::newGood(),
46 $provider->testForAccountLink( $user )
49 $res = AuthenticationResponse
::newPass();
50 $provider->postAuthentication( $user, $res );
51 $provider->postAccountCreation( $user, $user, $res );
52 $provider->postAccountLink( $user, $res );