16 $provider->continuePrimaryAuthentication( [] );
17 $this->fail(
'Expected exception not thrown' );
18 }
catch ( \BadMethodCallException $ex ) {
22 $provider->continuePrimaryAccountCreation(
$user,
$user, [] );
23 $this->fail(
'Expected exception not thrown' );
24 }
catch ( \BadMethodCallException $ex ) {
29 $this->assertTrue( $provider->providerAllowsPropertyChange(
'foo' ) );
32 $provider->testForAccountCreation(
$user,
$user, [] )
40 $provider->testUserForCreation(
$user,
false )
49 $provider->postAuthentication(
$user,
$res );
51 $provider->postAccountLink(
$user,
$res );
53 $provider->expects( $this->once() )
54 ->method(
'testUserExists' )
55 ->with( $this->equalTo(
'foo' ) )
56 ->will( $this->returnValue(
true ) );
57 $this->assertTrue( $provider->testUserCanAuthenticate(
'foo' ) );
62 for ( $i = 0; $i < 3; $i++ ) {
64 $reqs[$i]->done =
false;
68 $provider->expects( $this->once() )->method(
'getAuthenticationRequests' )
71 $this->identicalTo( [
'username' =>
'UTSysop' ] )
73 ->will( $this->returnValue( $reqs ) );
74 $provider->expects( $this->exactly( 3 ) )->method(
'providerChangeAuthenticationData' )
75 ->will( $this->returnCallback(
function (
$req ) {
76 $this->assertSame(
'UTSysop',
$req->username );
77 $this->assertFalse(
$req->done );
81 $provider->providerRevokeAccessForUser(
'UTSysop' );
83 foreach ( $reqs
as $i =>
$req ) {
84 $this->assertTrue(
$req->done,
"#$i" );
95 $provider->expects( $this->
any() )->method(
'accountCreationType' )
96 ->will( $this->returnValue(
$type ) );
99 $msg1 =
"{$class}::beginPrimaryAccountLink $msg";
100 $msg2 =
"{$class}::continuePrimaryAccountLink is not implemented.";
105 $provider->beginPrimaryAccountLink(
$user, [] );
106 $this->fail(
'Expected exception not thrown' );
107 }
catch ( \BadMethodCallException $ex ) {
108 $this->assertSame( $msg1, $ex->getMessage() );
111 $provider->continuePrimaryAccountLink(
$user, [] );
112 $this->fail(
'Expected exception not thrown' );
113 }
catch ( \BadMethodCallException $ex ) {
114 $this->assertSame( $msg2, $ex->getMessage() );
122 'should not be called on a non-link provider.',
126 'should not be called on a non-link provider.',
130 'is not implemented.',
141 'InterwikiLoadPrefix' => [
142 function ( $prefix, &$iwdata ) {
143 if ( $prefix ===
'interwiki' ) {
145 'iw_url' =>
'http://example.com/',
156 $this->assertSame( $expect, $provider->providerNormalizeUsername(
$name ) );
161 'Leading space' => [
' Leading space',
'Leading space' ],
162 'Trailing space ' => [
'Trailing space ',
'Trailing space' ],
163 'Namespace prefix' => [
'Talk:Username',
null ],
164 'Interwiki prefix' => [
'interwiki:Username',
null ],
165 'With hash' => [
'name with # hash',
null ],
166 'Multi spaces' => [
'Multi spaces',
'Multi spaces' ],
167 'Lowercase' => [
'lowercase',
'Lowercase' ],
168 'Invalid character' => [
'in[]valid',
null ],
169 'With slash' => [
'with / slash',
null ],
170 'Underscores' => [
'___under__scores___',
'Under scores' ],