);
}
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
public function testOnUserSaveSettings() {
$user = \User::newFromName( 'UTSysop' );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'updateExternalDB' )
->with( $this->identicalTo( $user ) );
public function testOnUserGroupsChanged() {
$user = \User::newFromName( 'UTSysop' );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'updateExternalDBGroups' )
->with(
);
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
- \Hooks::run( 'UserGroupsChanged', [ $user, [ 'added' ], [ 'removed' ] ] );
+ \Hooks::run( 'UserGroupsChanged', [ $user, [ 'added' ], [ 'removed' ], false, false, [], [] ] );
}
public function testOnUserLoggedIn() {
$user = \User::newFromName( 'UTSysop' );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->exactly( 2 ) )->method( 'updateUser' )
->with( $this->identicalTo( $user ) );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
\Hooks::run( 'UserLoggedIn', [ $user ] );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'updateUser' )
->will( $this->returnCallback( function ( &$user ) {
public function testOnLocalUserCreated() {
$user = \User::newFromName( 'UTSysop' );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->exactly( 2 ) )->method( 'initUser' )
->with( $this->identicalTo( $user ), $this->identicalTo( false ) );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
\Hooks::run( 'LocalUserCreated', [ $user, false ] );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'initUser' )
->will( $this->returnCallback( function ( &$user ) {
}
public function testGetUniqueId() {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$this->assertSame(
* @param bool $allowPasswordChange
*/
public function testGetAuthenticationRequests( $action, $response, $allowPasswordChange ) {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'allowPasswordChange' )
->will( $this->returnValue( $allowPasswordChange ) );
$req->action = AuthManager::ACTION_LOGIN;
$reqs = [ PasswordAuthenticationRequest::class => $req ];
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'authenticate' ] )
->getMock();
$plugin->expects( $this->never() )->method( 'authenticate' );
$req->username = 'foo';
$req->password = 'bar';
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'authenticate' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )
$provider->beginPrimaryAuthentication( $reqs )
);
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'authenticate' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )
$provider->beginPrimaryAuthentication( $reqs )
);
- $pluginUser = $this->getMockBuilder( 'AuthPluginUser' )
+ $pluginUser = $this->getMockBuilder( \AuthPluginUser::class )
->setMethods( [ 'isLocked' ] )
->disableOriginalConstructor()
->getMock();
$pluginUser->expects( $this->once() )->method( 'isLocked' )
->will( $this->returnValue( true ) );
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'getUserInstance', 'authenticate' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )
$provider->beginPrimaryAuthentication( $reqs )
);
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'authenticate' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )
$provider->beginPrimaryAuthentication( $reqs )
);
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'authenticate', 'strict' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )
$this->assertSame( AuthenticationResponse::FAIL, $ret->status );
$this->assertSame( 'wrongpassword', $ret->message->getKey() );
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'authenticate', 'strictUserAuth' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )
$this->assertSame( AuthenticationResponse::FAIL, $ret->status );
$this->assertSame( 'wrongpassword', $ret->message->getKey() );
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'domainList', 'validDomain', 'setDomain', 'userExists', 'authenticate' ] )
->getMock();
$plugin->expects( $this->any() )->method( 'domainList' )
}
public function testTestUserExists() {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
$this->assertTrue( $provider->testUserExists( 'foo' ) );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
}
public function testTestUserCanAuthenticate() {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$this->assertFalse( $provider->testUserCanAuthenticate( 'foo' ) );
- $pluginUser = $this->getMockBuilder( 'AuthPluginUser' )
+ $pluginUser = $this->getMockBuilder( \AuthPluginUser::class )
->disableOriginalConstructor()
->getMock();
$pluginUser->expects( $this->once() )->method( 'isLocked' )
->will( $this->returnValue( true ) );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
->will( $this->returnValue( true ) );
$plugin->expects( $this->once() )->method( 'getUserInstance' )
->with( $this->callback( function ( $user ) {
- $this->assertInstanceOf( 'User', $user );
+ $this->assertInstanceOf( \User::class, $user );
$this->assertEquals( 'Foo', $user->getName() );
return true;
} ) )
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$this->assertFalse( $provider->testUserCanAuthenticate( 'foo' ) );
- $pluginUser = $this->getMockBuilder( 'AuthPluginUser' )
+ $pluginUser = $this->getMockBuilder( \AuthPluginUser::class )
->disableOriginalConstructor()
->getMock();
$pluginUser->expects( $this->once() )->method( 'isLocked' )
->will( $this->returnValue( false ) );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
->will( $this->returnValue( true ) );
$plugin->expects( $this->once() )->method( 'getUserInstance' )
->with( $this->callback( function ( $user ) {
- $this->assertInstanceOf( 'User', $user );
+ $this->assertInstanceOf( \User::class, $user );
$this->assertEquals( 'Foo', $user->getName() );
return true;
} ) )
}
public function testProviderRevokeAccessForUser() {
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'userExists', 'setPassword' ] )
->getMock();
$plugin->expects( $this->once() )->method( 'userExists' )->willReturn( true );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$provider->providerRevokeAccessForUser( 'foo' );
- $plugin = $this->getMockBuilder( 'AuthPlugin' )
+ $plugin = $this->getMockBuilder( \AuthPlugin::class )
->setMethods( [ 'domainList', 'userExists', 'setPassword' ] )
->getMock();
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [ 'D1', 'D2', 'D3' ] );
}
public function testProviderAllowsPropertyChange() {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'allowPropChange' )
->will( $this->returnCallback( function ( $prop ) {
*/
public function testProviderAllowsAuthenticationDataChange( $type, $allow, $expect ) {
$domains = $type instanceof PasswordDomainAuthenticationRequest ? [ 'foo', 'bar' ] : [];
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( $domains );
$plugin->expects( $allow === null ? $this->never() : $this->once() )
->method( 'allowPasswordChange' )->will( $this->returnValue( $allow ) );
}
public function testProviderChangeAuthenticationData() {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->never() )->method( 'setPassword' );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$req->username = 'foo';
$req->password = 'bar';
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'setPassword' )
->with( $this->callback( function ( $u ) {
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$provider->providerChangeAuthenticationData( $req );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'setPassword' )
->with( $this->callback( function ( $u ) {
$this->assertSame( 'authmanager-authplugin-setpass-failed-message', $e->msg );
}
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )
->will( $this->returnValue( [ 'Domain1', 'Domain2' ] ) );
$plugin->expects( $this->any() )->method( 'validDomain' )
* @param string $expect
*/
public function testAccountCreationType( $can, $expect ) {
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )
->method( 'canCreateAccounts' )->will( $this->returnValue( $can ) );
public function testTestForAccountCreation() {
$user = \User::newFromName( 'foo' );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$this->assertEquals(
$req->action = AuthManager::ACTION_CREATE;
$reqs = [ PasswordAuthenticationRequest::class => $req ];
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( false ) );
);
}
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( true ) );
$req->username = 'foo';
$req->password = 'bar';
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( true ) );
$provider->beginPrimaryAccountCreation( $user, $user, $reqs )
);
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( true ) );
$this->assertSame( AuthenticationResponse::FAIL, $ret->status );
$this->assertSame( 'authmanager-authplugin-create-fail', $ret->message->getKey() );
- $plugin = $this->createMock( 'AuthPlugin' );
+ $plugin = $this->createMock( \AuthPlugin::class );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( true ) );
$plugin->expects( $this->any() )->method( 'domainList' )