namespace MediaWiki\Auth;
+use Wikimedia\TestingAccessWrapper;
+
/**
* @group AuthManager
* @group Database
class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase {
public function testConstructor() {
$provider = new ThrottlePreAuthenticationProvider();
- $providerPriv = \TestingAccessWrapper::newFromObject( $provider );
+ $providerPriv = TestingAccessWrapper::newFromObject( $provider );
$config = new \HashConfig( [
'AccountCreationThrottle' => [ [
'count' => 123,
'accountCreationThrottle' => [ [ 'count' => 123, 'seconds' => 86400 ] ],
'passwordAttemptThrottle' => [ [ 'count' => 5, 'seconds' => 300 ] ]
], $providerPriv->throttleSettings );
- $accountCreationThrottle = \TestingAccessWrapper::newFromObject(
+ $accountCreationThrottle = TestingAccessWrapper::newFromObject(
$providerPriv->accountCreationThrottle );
$this->assertSame( [ [ 'count' => 123, 'seconds' => 86400 ] ],
$accountCreationThrottle->conditions );
- $passwordAttemptThrottle = \TestingAccessWrapper::newFromObject(
+ $passwordAttemptThrottle = TestingAccessWrapper::newFromObject(
$providerPriv->passwordAttemptThrottle );
$this->assertSame( [ [ 'count' => 5, 'seconds' => 300 ] ],
$passwordAttemptThrottle->conditions );
'accountCreationThrottle' => [ [ 'count' => 43, 'seconds' => 10000 ] ],
'passwordAttemptThrottle' => [ [ 'count' => 11, 'seconds' => 100 ] ],
] );
- $providerPriv = \TestingAccessWrapper::newFromObject( $provider );
+ $providerPriv = TestingAccessWrapper::newFromObject( $provider );
$config = new \HashConfig( [
'AccountCreationThrottle' => [ [
'count' => 123,
$cache = new \HashBagOStuff();
$provider = new ThrottlePreAuthenticationProvider( [ 'cache' => $cache ] );
- $providerPriv = \TestingAccessWrapper::newFromObject( $provider );
+ $providerPriv = TestingAccessWrapper::newFromObject( $provider );
$provider->setConfig( new \HashConfig( [
'AccountCreationThrottle' => [ [ 'count' => 1, 'seconds' => 1 ] ],
'PasswordAttemptThrottle' => [ [ 'count' => 1, 'seconds' => 1 ] ],
] ) );
- $accountCreationThrottle = \TestingAccessWrapper::newFromObject(
+ $accountCreationThrottle = TestingAccessWrapper::newFromObject(
$providerPriv->accountCreationThrottle );
$this->assertSame( $cache, $accountCreationThrottle->cache );
- $passwordAttemptThrottle = \TestingAccessWrapper::newFromObject(
+ $passwordAttemptThrottle = TestingAccessWrapper::newFromObject(
$providerPriv->passwordAttemptThrottle );
$this->assertSame( $cache, $passwordAttemptThrottle->cache );
}
$user = \User::newFromName( 'RandomUser' );
$creator = \User::newFromName( $creatorname );
if ( $hook ) {
- $mock = $this->getMockBuilder( 'stdClass' )
+ $mock = $this->getMockBuilder( stdClass::class )
->setMethods( [ 'onExemptFromAccountCreationThrottle' ] )
->getMock();
$mock->expects( $this->any() )->method( 'onExemptFromAccountCreationThrottle' )