MediaWiki  REL1_31
CreateFromLoginAuthenticationRequestTest.php
Go to the documentation of this file.
1 <?php
2 
3 namespace MediaWiki\Auth;
4 
10 
11  protected function getInstance( array $args = [] ) {
13  null, []
14  );
15  }
16 
17  public function provideLoadFromSubmission() {
18  return [
19  'Empty request' => [
20  [],
21  [],
22  [],
23  ],
24  ];
25  }
26 
30  public function testState(
31  $createReq, $maybeLink, $username, $loginState, $createState, $createPrimaryState
32  ) {
33  $req = new CreateFromLoginAuthenticationRequest( $createReq, $maybeLink );
34  $this->assertSame( $username, $req->username );
35  $this->assertSame( $loginState, $req->hasStateForAction( AuthManager::ACTION_LOGIN ) );
36  $this->assertSame( $createState, $req->hasStateForAction( AuthManager::ACTION_CREATE ) );
37  $this->assertFalse( $req->hasStateForAction( AuthManager::ACTION_LINK ) );
38  $this->assertFalse( $req->hasPrimaryStateForAction( AuthManager::ACTION_LOGIN ) );
39  $this->assertSame( $createPrimaryState,
40  $req->hasPrimaryStateForAction( AuthManager::ACTION_CREATE ) );
41  }
42 
43  public static function provideState() {
46  $req2->username = 'Bob';
47 
48  return [
49  'Nothing' => [ null, [], null, false, false, false ],
50  'Link, no create' => [ null, [ $req2 ], null, true, true, false ],
51  'No link, create but no name' => [ $req1, [], null, false, true, true ],
52  'Link and create but no name' => [ $req1, [ $req2 ], null, true, true, true ],
53  'No link, create with name' => [ $req2, [], 'Bob', false, true, true ],
54  'Link and create with name' => [ $req2, [ $req2 ], 'Bob', true, true, true ],
55  ];
56  }
57 }
array
the array() calling protocol came about after MediaWiki 1.4rc1.
MediaWiki\Auth\CreateFromLoginAuthenticationRequestTest\provideLoadFromSubmission
provideLoadFromSubmission()
Definition: CreateFromLoginAuthenticationRequestTest.php:17
true
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:2006
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:37
MediaWiki\Auth\CreateFromLoginAuthenticationRequestTest\getInstance
getInstance(array $args=[])
Definition: CreateFromLoginAuthenticationRequestTest.php:11
MediaWiki\Auth\CreateFromLoginAuthenticationRequest
This transfers state between the login and account creation flows.
Definition: CreateFromLoginAuthenticationRequest.php:34
MediaWiki\Auth\CreateFromLoginAuthenticationRequestTest
AuthManager MediaWiki\Auth\CreateFromLoginAuthenticationRequest.
Definition: CreateFromLoginAuthenticationRequestTest.php:9
MediaWiki\Auth\UsernameAuthenticationRequest
AuthenticationRequest to ensure something with a username is present.
Definition: UsernameAuthenticationRequest.php:29
MediaWiki\Auth\AuthManager\ACTION_CREATE
const ACTION_CREATE
Create a new user.
Definition: AuthManager.php:90
MediaWiki\Auth\AuthManager\ACTION_LINK
const ACTION_LINK
Link an existing user to a third-party account.
Definition: AuthManager.php:95
$req
this hook is for auditing only $req
Definition: hooks.txt:990
$args
if( $line===false) $args
Definition: cdb.php:64
MediaWiki\Auth\AuthManager\ACTION_LOGIN
const ACTION_LOGIN
Log in with an existing (not necessarily local) user.
Definition: AuthManager.php:85
$username
this hook is for auditing only or null if authentication failed before getting that far $username
Definition: hooks.txt:785
MediaWiki\Auth\AuthenticationRequestTestCase
AuthManager.
Definition: AuthenticationRequestTestCase.php:8
MediaWiki\Auth\CreateFromLoginAuthenticationRequestTest\testState
testState( $createReq, $maybeLink, $username, $loginState, $createState, $createPrimaryState)
provideState
Definition: CreateFromLoginAuthenticationRequestTest.php:30
MediaWiki\Auth
Definition: AbstractAuthenticationProvider.php:22
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
MediaWiki\Auth\CreateFromLoginAuthenticationRequestTest\provideState
static provideState()
Definition: CreateFromLoginAuthenticationRequestTest.php:43