X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fauth%2FThrottlePreAuthenticationProviderTest.php;h=d03b15156cf1bc58047da7ad7fa6e2c8797b976d;hb=dcee65673b531ebe39a093ee0c021a926ea74ad9;hp=2f3e27c6fe88265472035ae6153bfd8330b3144a;hpb=980c688c2b9833fd83c3f4a7f5bf75031a071c74;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php b/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php index 2f3e27c6fe..d03b15156c 100644 --- a/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php +++ b/tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php @@ -2,6 +2,8 @@ namespace MediaWiki\Auth; +use Wikimedia\TestingAccessWrapper; + /** * @group AuthManager * @group Database @@ -10,7 +12,7 @@ namespace MediaWiki\Auth; class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase { public function testConstructor() { $provider = new ThrottlePreAuthenticationProvider(); - $providerPriv = \TestingAccessWrapper::newFromObject( $provider ); + $providerPriv = TestingAccessWrapper::newFromObject( $provider ); $config = new \HashConfig( [ 'AccountCreationThrottle' => [ [ 'count' => 123, @@ -26,11 +28,11 @@ class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase { '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 ); @@ -39,7 +41,7 @@ class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase { 'accountCreationThrottle' => [ [ 'count' => 43, 'seconds' => 10000 ] ], 'passwordAttemptThrottle' => [ [ 'count' => 11, 'seconds' => 100 ] ], ] ); - $providerPriv = \TestingAccessWrapper::newFromObject( $provider ); + $providerPriv = TestingAccessWrapper::newFromObject( $provider ); $config = new \HashConfig( [ 'AccountCreationThrottle' => [ [ 'count' => 123, @@ -58,15 +60,15 @@ class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase { $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 ); } @@ -119,7 +121,9 @@ class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase { $user = \User::newFromName( 'RandomUser' ); $creator = \User::newFromName( $creatorname ); if ( $hook ) { - $mock = $this->getMock( 'stdClass', [ 'onExemptFromAccountCreationThrottle' ] ); + $mock = $this->getMockBuilder( stdClass::class ) + ->setMethods( [ 'onExemptFromAccountCreationThrottle' ] ) + ->getMock(); $mock->expects( $this->any() )->method( 'onExemptFromAccountCreationThrottle' ) ->will( $this->returnValue( false ) ); $this->mergeMwGlobalArrayValue( 'wgHooks', [