MediaWiki  1.30.0
AbstractPreAuthenticationProviderTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Auth;
4 
11  $user = \User::newFromName( 'UTSysop' );
12 
13  $provider = $this->getMockForAbstractClass( AbstractPreAuthenticationProvider::class );
14 
15  $this->assertEquals(
16  [],
17  $provider->getAuthenticationRequests( AuthManager::ACTION_LOGIN, [] )
18  );
19  $this->assertEquals(
21  $provider->testForAuthentication( [] )
22  );
23  $this->assertEquals(
25  $provider->testForAccountCreation( $user, $user, [] )
26  );
27  $this->assertEquals(
29  $provider->testUserForCreation( $user, AuthManager::AUTOCREATE_SOURCE_SESSION )
30  );
31  $this->assertEquals(
33  $provider->testUserForCreation( $user, false )
34  );
35  $this->assertEquals(
37  $provider->testForAccountLink( $user )
38  );
39 
41  $provider->postAuthentication( $user, $res );
42  $provider->postAccountCreation( $user, $user, $res );
43  $provider->postAccountLink( $user, $res );
44  }
45 }
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:244
MediaWiki\Auth\AuthManager\AUTOCREATE_SOURCE_SESSION
const AUTOCREATE_SOURCE_SESSION
Auto-creation is due to SessionManager.
Definition: AuthManager.php:113
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:550
$res
$res
Definition: database.txt:21
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
MediaWiki\Auth\AbstractPreAuthenticationProviderTest\testAbstractPreAuthenticationProvider
testAbstractPreAuthenticationProvider()
Definition: AbstractPreAuthenticationProviderTest.php:10
MediaWikiTestCase
Definition: MediaWikiTestCase.php:15
StatusValue\newGood
static newGood( $value=null)
Factory function for good results.
Definition: StatusValue.php:81
MediaWiki\Auth\AuthManager\ACTION_LOGIN
const ACTION_LOGIN
Log in with an existing (not necessarily local) user.
Definition: AuthManager.php:84
MediaWiki\Auth\AbstractPreAuthenticationProviderTest
AuthManager MediaWiki\Auth\AbstractPreAuthenticationProvider.
Definition: AbstractPreAuthenticationProviderTest.php:9
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
MediaWiki\Auth
Definition: AbstractAuthenticationProvider.php:22
MediaWiki\Auth\AuthenticationResponse\newPass
static newPass( $username=null)
Definition: AuthenticationResponse.php:134