);
}
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$provider->getAuthenticationRequests( AuthManager::ACTION_LOGIN, [] )
);
- $req = $this->getMock( PasswordAuthenticationRequest::class );
+ $req = $this->createMock( PasswordAuthenticationRequest::class );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin, get_class( $req ) );
$this->assertEquals(
[ $req ],
$provider->getAuthenticationRequests( AuthManager::ACTION_LOGIN, [] )
);
- $reqType = get_class( $this->getMock( AuthenticationRequest::class ) );
+ $reqType = get_class( $this->createMock( AuthenticationRequest::class ) );
try {
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin, $reqType );
$this->fail( 'Expected exception not thrown' );
public function testOnUserSaveSettings() {
$user = \User::newFromName( 'UTSysop' );
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'updateExternalDBGroups' )
->with(
public function testOnUserLoggedIn() {
$user = \User::newFromName( 'UTSysop' );
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'initUser' )
->will( $this->returnCallback( function ( &$user ) {
}
public function testGetUniqueId() {
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$this->assertSame(
* @param bool $allowPasswordChange
*/
public function testGetAuthenticationRequests( $action, $response, $allowPasswordChange ) {
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'allowPasswordChange' )
->will( $this->returnValue( $allowPasswordChange ) );
}
public function testTestUserExists() {
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
$this->assertTrue( $provider->testUserExists( 'foo' ) );
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
}
public function testTestUserCanAuthenticate() {
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
->getMock();
$pluginUser->expects( $this->once() )->method( 'isLocked' )
->will( $this->returnValue( true ) );
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
->getMock();
$pluginUser->expects( $this->once() )->method( 'isLocked' )
->will( $this->returnValue( false ) );
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->once() )->method( 'userExists' )
->with( $this->equalTo( 'Foo' ) )
}
public function testProviderAllowsPropertyChange() {
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( $domains );
$plugin->expects( $allow === null ? $this->never() : $this->once() )
->method( 'allowPasswordChange' )->will( $this->returnValue( $allow ) );
if ( is_object( $type ) ) {
$req = $type;
} else {
- $req = $this->getMock( $type );
+ $req = $this->createMock( $type );
}
$req->action = AuthManager::ACTION_CHANGE;
$req->username = 'UTSysop';
}
public function testProviderChangeAuthenticationData() {
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->never() )->method( 'setPassword' );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$provider->providerChangeAuthenticationData(
- $this->getMock( AuthenticationRequest::class )
+ $this->createMock( AuthenticationRequest::class )
);
$req = new PasswordAuthenticationRequest();
$req->username = 'foo';
$req->password = 'bar';
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$provider = new AuthPluginPrimaryAuthenticationProvider( $plugin );
$this->assertEquals(
$req->action = AuthManager::ACTION_CREATE;
$reqs = [ PasswordAuthenticationRequest::class => $req ];
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( false ) );
);
}
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'domainList' )->willReturn( [] );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( true ) );
$provider->beginPrimaryAccountCreation( $user, $user, $reqs )
);
- $plugin = $this->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$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->getMock( 'AuthPlugin' );
+ $plugin = $this->createMock( 'AuthPlugin' );
$plugin->expects( $this->any() )->method( 'canCreateAccounts' )
->will( $this->returnValue( true ) );
$plugin->expects( $this->any() )->method( 'domainList' )