namespace MediaWiki\Auth;
+use MediaWiki\MediaWikiServices;
+
/**
* @group AuthManager
* @group Database
}
$config = new \MultiConfig( [
$this->config,
- \ConfigFactory::getDefaultInstance()->makeConfig( 'main' )
+ MediaWikiServices::getInstance()->getMainConfig()
] );
if ( !$this->manager ) {
}
$this->validity = \Status::newGood();
- $provider = $this->getMock(
- LocalPasswordPrimaryAuthenticationProvider::class,
- [ 'checkPasswordValidity' ],
- [ [ 'loginOnly' => $loginOnly ] ]
- );
+ $provider = $this->getMockBuilder( LocalPasswordPrimaryAuthenticationProvider::class )
+ ->setMethods( [ 'checkPasswordValidity' ] )
+ ->setConstructorArgs( [ [ 'loginOnly' => $loginOnly ] ] )
+ ->getMock();
$provider->expects( $this->any() )->method( 'checkPasswordValidity' )
->will( $this->returnCallback( function () {
return $this->validity;
} elseif ( $type === PasswordDomainAuthenticationRequest::class ) {
$req = new $type( [] );
} else {
- $req = $this->getMock( $type );
+ $req = $this->createMock( $type );
}
$req->action = AuthManager::ACTION_CHANGE;
$req->username = $user;
if ( $type === PasswordAuthenticationRequest::class ) {
$changeReq = new $type();
} else {
- $changeReq = $this->getMock( $type );
+ $changeReq = $this->createMock( $type );
}
$changeReq->action = AuthManager::ACTION_CHANGE;
$changeReq->username = $user;
$changeReq->password = $newpass;
$provider->providerChangeAuthenticationData( $changeReq );
- if ( $loginOnly ) {
+ if ( $loginOnly && $changed ) {
$old = 'fail';
$new = 'fail';
$expectExpiry = null;