MediaWiki REL1_33
CreateFromLoginAuthenticationRequestTest.php
Go to the documentation of this file.
1<?php
2
3namespace 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}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
if( $line===false) $args
Definition cdb.php:64
const ACTION_LINK
Link an existing user to a third-party account.
const ACTION_LOGIN
Log in with an existing (not necessarily local) user.
const ACTION_CREATE
Create a new user.
AuthManager \MediaWiki\Auth\CreateFromLoginAuthenticationRequest.
testState( $createReq, $maybeLink, $username, $loginState, $createState, $createPrimaryState)
provideState
This transfers state between the login and account creation flows.
AuthenticationRequest to ensure something with a username is present.
this hook is for auditing only $req
Definition hooks.txt:979
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:2004
this hook is for auditing only or null if authentication failed before getting that far $username
Definition hooks.txt:782
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))