MediaWiki  master
MediaWiki\Auth\AuthManagerTest Class Reference

AuthManager Database \MediaWiki\Auth\AuthManager. More...

Inheritance diagram for MediaWiki\Auth\AuthManagerTest:
Collaboration diagram for MediaWiki\Auth\AuthManagerTest:

Public Member Functions

 onSecuritySensitiveOperationStatus (&$status, $operation, $session, $time)
 
 provideAccountCreation ()
 
 provideAccountLink ()
 
 provideAuthentication ()
 
 provideSetDefaultUserOptions ()
 
 testAccountCreation (StatusValue $preTest, $primaryTest, $secondaryTest, array $primaryResponses, array $secondaryResponses, array $managerResponses)
 provideAccountCreation More...
 
 testAccountCreationLogging ( $isAnon, $logSubtype)
 provideAccountCreationLogging More...
 
 testAccountLink (StatusValue $preTest, array $primaryResponses, array $managerResponses)
 provideAccountLink More...
 
 testAllowsAuthenticationDataChange ( $primaryReturn, $secondaryReturn, $expect)
 provideAllowsAuthenticationDataChange More...
 
 testAllowsPropertyChange ()
 
 testAuthentication (StatusValue $preResponse, array $primaryResponses, array $secondaryResponses, array $managerResponses, $link=false)
 provideAuthentication More...
 
 testAuthenticationSessionData ()
 
 testAutoAccountCreation ()
 
 testAutoCreateFailOnLogin ()
 
 testAutoCreateOnLogin ()
 
 testBeginAccountCreation ()
 
 testBeginAccountLink ()
 
 testBeginAuthentication ()
 
 testCanAuthenticateNow ()
 
 testCanCreateAccount ()
 
 testCanCreateAccounts ()
 
 testCanLinkAccounts ()
 
 testChangeAuthenticationData ()
 
 testCheckAccountCreatePermissions ()
 
 testContinueAccountCreation ()
 
 testContinueAccountLink ()
 
 testCreateFromLogin ()
 
 testForcePrimaryAuthenticationProviders ()
 
 testGetAuthenticationRequests ( $action, $expect, $state=[])
 provideGetAuthenticationRequests More...
 
 testGetAuthenticationRequestsRequired ()
 
 testNormalizeUsername ()
 
 testProviderCreation ()
 
 testRevokeAccessForUser ()
 
 testSecuritySensitiveOperationStatus ( $mutableSession)
 provideSecuritySensitiveOperationStatus More...
 
 testSetDefaultUserOptions ( $contLang, $useContextLang, $expectedLang, $expectedVariant)
 provideSetDefaultUserOptions More...
 
 testSingleton ()
 
 testUserCanAuthenticate ( $primary1Can, $primary2Can, $expect)
 provideUserCanAuthenticate More...
 
 testUserExists ( $primary1Exists, $primary2Exists, $expect)
 provideUserExists More...
 

Static Public Member Functions

static provideAccountCreationLogging ()
 
static provideAllowsAuthenticationDataChange ()
 
static provideGetAuthenticationRequests ()
 
static provideSecuritySensitiveOperationStatus ()
 
static provideUserCanAuthenticate ()
 
static provideUserExists ()
 

Protected Member Functions

 getMockSessionProvider ( $canChangeUser=null, array $methods=[])
 Setup SessionManager with a mock session provider. More...
 
 hook ( $hook, $expect)
 Sets a mock on a hook. More...
 
 initializeConfig ()
 Initialize the AuthManagerConfig variable in $this->config. More...
 
 initializeManager ( $regen=false)
 Initialize $this->manager. More...
 
 message ( $key, $params=[])
 Ensure a value is a clean Message object. More...
 
 unhook ( $hook)
 Unsets a hook. More...
 

Protected Attributes

Config $config
 
LoggerInterface $logger
 
AuthManager $manager
 
TestingAccessWrapper $managerPriv
 
 $preauthMocks = []
 
 $primaryauthMocks = []
 
WebRequest $request
 
 $secondaryauthMocks = []
 

Private Member Functions

 assertResponseEquals (AuthenticationResponse $expected, AuthenticationResponse $actual, $msg='')
 Test two AuthenticationResponses for equality. More...
 

Static Private Member Functions

static usernameForCreation ( $uniq='')
 

Detailed Description

AuthManager Database \MediaWiki\Auth\AuthManager.

Definition at line 21 of file AuthManagerTest.php.

Member Function Documentation

◆ assertResponseEquals()

MediaWiki\Auth\AuthManagerTest::assertResponseEquals ( AuthenticationResponse  $expected,
AuthenticationResponse  $actual,
  $msg = '' 
)
private

Test two AuthenticationResponses for equality.

We don't want to use regular assertEquals because that recursively compares members, which leads to false negatives if e.g. Language caches are reset.

Parameters
AuthenticationResponse$response1
AuthenticationResponse$response2
string$msg
Returns
bool

Definition at line 88 of file AuthManagerTest.php.

References $name, and as.

Referenced by MediaWiki\Auth\AuthManagerTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountLink(), and MediaWiki\Auth\AuthManagerTest\testAuthentication().

◆ getMockSessionProvider()

MediaWiki\Auth\AuthManagerTest::getMockSessionProvider (   $canChangeUser = null,
array  $methods = [] 
)
protected

Setup SessionManager with a mock session provider.

Parameters
bool | null$canChangeUserIf non-null, canChangeUser will be mocked to return this
array$methodsAdditional methods to mock
Returns
array (MediaWiki\Session\SessionProvider, ScopedCallback)

Definition at line 161 of file AuthManagerTest.php.

References class, MediaWiki\Auth\AuthManagerTest\initializeConfig(), null, request, MediaWiki\Session\TestUtils\setSessionManagerSingleton(), and use.

Referenced by MediaWiki\Auth\AuthManagerTest\testBeginAuthentication(), MediaWiki\Auth\AuthManagerTest\testCanAuthenticateNow(), and MediaWiki\Auth\AuthManagerTest\testSecuritySensitiveOperationStatus().

◆ hook()

◆ initializeConfig()

MediaWiki\Auth\AuthManagerTest::initializeConfig ( )
protected

Initialize the AuthManagerConfig variable in $this->config.

Uses data from the various 'mocks' fields.

Definition at line 108 of file AuthManagerTest.php.

References $type, as, and use.

Referenced by MediaWiki\Auth\AuthManagerTest\getMockSessionProvider(), MediaWiki\Auth\AuthManagerTest\initializeManager(), and MediaWiki\Auth\AuthManagerTest\testProviderCreation().

◆ initializeManager()

MediaWiki\Auth\AuthManagerTest::initializeManager (   $regen = false)
protected

Initialize $this->manager.

Parameters
bool$regenForce a call to $this->initializeConfig()

Definition at line 136 of file AuthManagerTest.php.

References MediaWiki\Auth\AuthManagerTest\initializeConfig(), and request.

Referenced by MediaWiki\Auth\AuthManagerTest\testAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAccountCreationLogging(), MediaWiki\Auth\AuthManagerTest\testAccountLink(), MediaWiki\Auth\AuthManagerTest\testAllowsAuthenticationDataChange(), MediaWiki\Auth\AuthManagerTest\testAllowsPropertyChange(), MediaWiki\Auth\AuthManagerTest\testAuthentication(), MediaWiki\Auth\AuthManagerTest\testAuthenticationSessionData(), MediaWiki\Auth\AuthManagerTest\testAutoAccountCreation(), MediaWiki\Auth\AuthManagerTest\testAutoCreateFailOnLogin(), MediaWiki\Auth\AuthManagerTest\testAutoCreateOnLogin(), MediaWiki\Auth\AuthManagerTest\testBeginAccountCreation(), MediaWiki\Auth\AuthManagerTest\testBeginAccountLink(), MediaWiki\Auth\AuthManagerTest\testBeginAuthentication(), MediaWiki\Auth\AuthManagerTest\testCanAuthenticateNow(), MediaWiki\Auth\AuthManagerTest\testCanCreateAccount(), MediaWiki\Auth\AuthManagerTest\testCanCreateAccounts(), MediaWiki\Auth\AuthManagerTest\testCanLinkAccounts(), MediaWiki\Auth\AuthManagerTest\testChangeAuthenticationData(), MediaWiki\Auth\AuthManagerTest\testCheckAccountCreatePermissions(), MediaWiki\Auth\AuthManagerTest\testContinueAccountCreation(), MediaWiki\Auth\AuthManagerTest\testContinueAccountLink(), MediaWiki\Auth\AuthManagerTest\testCreateFromLogin(), MediaWiki\Auth\AuthManagerTest\testForcePrimaryAuthenticationProviders(), MediaWiki\Auth\AuthManagerTest\testGetAuthenticationRequests(), MediaWiki\Auth\AuthManagerTest\testGetAuthenticationRequestsRequired(), MediaWiki\Auth\AuthManagerTest\testNormalizeUsername(), MediaWiki\Auth\AuthManagerTest\testProviderCreation(), MediaWiki\Auth\AuthManagerTest\testRevokeAccessForUser(), MediaWiki\Auth\AuthManagerTest\testSecuritySensitiveOperationStatus(), MediaWiki\Auth\AuthManagerTest\testSetDefaultUserOptions(), MediaWiki\Auth\AuthManagerTest\testUserCanAuthenticate(), and MediaWiki\Auth\AuthManagerTest\testUserExists().

◆ message()

◆ onSecuritySensitiveOperationStatus()

MediaWiki\Auth\AuthManagerTest::onSecuritySensitiveOperationStatus ( $status,
  $operation,
  $session,
  $time 
)

Definition at line 416 of file AuthManagerTest.php.

◆ provideAccountCreation()

◆ provideAccountCreationLogging()

static MediaWiki\Auth\AuthManagerTest::provideAccountCreationLogging ( )
static

Definition at line 2343 of file AuthManagerTest.php.

References null.

◆ provideAccountLink()

◆ provideAllowsAuthenticationDataChange()

static MediaWiki\Auth\AuthManagerTest::provideAllowsAuthenticationDataChange ( )
static

◆ provideAuthentication()

◆ provideGetAuthenticationRequests()

◆ provideSecuritySensitiveOperationStatus()

static MediaWiki\Auth\AuthManagerTest::provideSecuritySensitiveOperationStatus ( )
static

Definition at line 419 of file AuthManagerTest.php.

References false, and true.

◆ provideSetDefaultUserOptions()

MediaWiki\Auth\AuthManagerTest::provideSetDefaultUserOptions ( )

Definition at line 632 of file AuthManagerTest.php.

References null.

◆ provideUserCanAuthenticate()

static MediaWiki\Auth\AuthManagerTest::provideUserCanAuthenticate ( )
static

Definition at line 451 of file AuthManagerTest.php.

References false, and true.

◆ provideUserExists()

static MediaWiki\Auth\AuthManagerTest::provideUserExists ( )
static

Definition at line 1277 of file AuthManagerTest.php.

References false, and true.

◆ testAccountCreation()

◆ testAccountCreationLogging()

MediaWiki\Auth\AuthManagerTest::testAccountCreationLogging (   $isAnon,
  $logSubtype 
)

◆ testAccountLink()

◆ testAllowsAuthenticationDataChange()

MediaWiki\Auth\AuthManagerTest::testAllowsAuthenticationDataChange (   $primaryReturn,
  $secondaryReturn,
  $expect 
)

provideAllowsAuthenticationDataChange

Parameters
StatusValue$primaryReturn
StatusValue$secondaryReturn
Status$expect

Definition at line 1292 of file AuthManagerTest.php.

References $req, class, and MediaWiki\Auth\AuthManagerTest\initializeManager().

◆ testAllowsPropertyChange()

MediaWiki\Auth\AuthManagerTest::testAllowsPropertyChange ( )

Definition at line 3161 of file AuthManagerTest.php.

References as, MediaWiki\Auth\AuthManagerTest\initializeManager(), and use.

◆ testAuthentication()

◆ testAuthenticationSessionData()

MediaWiki\Auth\AuthManagerTest::testAuthenticationSessionData ( )

◆ testAutoAccountCreation()

◆ testAutoCreateFailOnLogin()

◆ testAutoCreateOnLogin()

◆ testBeginAccountCreation()

◆ testBeginAccountLink()

◆ testBeginAuthentication()

◆ testCanAuthenticateNow()

MediaWiki\Auth\AuthManagerTest::testCanAuthenticateNow ( )

◆ testCanCreateAccount()

◆ testCanCreateAccounts()

◆ testCanLinkAccounts()

◆ testChangeAuthenticationData()

MediaWiki\Auth\AuthManagerTest::testChangeAuthenticationData ( )

◆ testCheckAccountCreatePermissions()

◆ testContinueAccountCreation()

◆ testContinueAccountLink()

◆ testCreateFromLogin()

◆ testForcePrimaryAuthenticationProviders()

MediaWiki\Auth\AuthManagerTest::testForcePrimaryAuthenticationProviders ( )

◆ testGetAuthenticationRequests()

◆ testGetAuthenticationRequestsRequired()

◆ testNormalizeUsername()

MediaWiki\Auth\AuthManagerTest::testNormalizeUsername ( )

◆ testProviderCreation()

MediaWiki\Auth\AuthManagerTest::testProviderCreation ( )

◆ testRevokeAccessForUser()

MediaWiki\Auth\AuthManagerTest::testRevokeAccessForUser ( )

◆ testSecuritySensitiveOperationStatus()

◆ testSetDefaultUserOptions()

MediaWiki\Auth\AuthManagerTest::testSetDefaultUserOptions (   $contLang,
  $useContextLang,
  $expectedLang,
  $expectedVariant 
)

◆ testSingleton()

MediaWiki\Auth\AuthManagerTest::testSingleton ( )

◆ testUserCanAuthenticate()

MediaWiki\Auth\AuthManagerTest::testUserCanAuthenticate (   $primary1Can,
  $primary2Can,
  $expect 
)

provideUserCanAuthenticate

Parameters
bool$primary1Can
bool$primary2Can
bool$expect

Definition at line 432 of file AuthManagerTest.php.

References class, and MediaWiki\Auth\AuthManagerTest\initializeManager().

◆ testUserExists()

MediaWiki\Auth\AuthManagerTest::testUserExists (   $primary1Exists,
  $primary2Exists,
  $expect 
)

provideUserExists

Parameters
bool$primary1Exists
bool$primary2Exists
bool$expect

Definition at line 1258 of file AuthManagerTest.php.

References class, and MediaWiki\Auth\AuthManagerTest\initializeManager().

◆ unhook()

◆ usernameForCreation()

static MediaWiki\Auth\AuthManagerTest::usernameForCreation (   $uniq = '')
staticprivate
Parameters
string$uniq
Returns
string

Definition at line 1490 of file AuthManagerTest.php.

References $username, and User\newFromName().

Member Data Documentation

◆ $config

Config MediaWiki\Auth\AuthManagerTest::$config
protected

Definition at line 25 of file AuthManagerTest.php.

◆ $logger

LoggerInterface MediaWiki\Auth\AuthManagerTest::$logger
protected

Definition at line 27 of file AuthManagerTest.php.

◆ $manager

AuthManager MediaWiki\Auth\AuthManagerTest::$manager
protected

Definition at line 34 of file AuthManagerTest.php.

◆ $managerPriv

TestingAccessWrapper MediaWiki\Auth\AuthManagerTest::$managerPriv
protected

Definition at line 36 of file AuthManagerTest.php.

◆ $preauthMocks

MediaWiki\Auth\AuthManagerTest::$preauthMocks = []
protected

Definition at line 29 of file AuthManagerTest.php.

◆ $primaryauthMocks

MediaWiki\Auth\AuthManagerTest::$primaryauthMocks = []
protected

Definition at line 30 of file AuthManagerTest.php.

◆ $request

WebRequest MediaWiki\Auth\AuthManagerTest::$request
protected

Definition at line 23 of file AuthManagerTest.php.

◆ $secondaryauthMocks

MediaWiki\Auth\AuthManagerTest::$secondaryauthMocks = []
protected

Definition at line 31 of file AuthManagerTest.php.


The documentation for this class was generated from the following file: