MediaWiki  1.28.1
Go to the documentation of this file.
1 <?php
3 namespace MediaWiki\Auth;
11  $user = \User::newFromName( 'UTSysop' );
13  $provider = $this->getMockForAbstractClass( AbstractPreAuthenticationProvider::class );
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  );
41  $provider->postAuthentication( $user, $res );
42  $provider->postAccountCreation( $user, $user, $res );
43  $provider->postAccountLink( $user, $res );
44  }
45 }
static newFromName($name, $validate= 'valid')
Static factory method for creation from username.
Definition: User.php:525
AuthManager MediaWiki\Auth\AbstractPreAuthenticationProvider.
Definition: database.txt:21
Auto-creation is due to SessionManager.
static newGood($value=null)
Factory function for good results.
Definition: StatusValue.php:76
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 local account $user
Definition: hooks.txt:242
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
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
Log in with an existing (not necessarily local) user.
Definition: AuthManager.php:83