X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fauth%2FAuthManagerTest.php;h=f57db11b236987fb41d227d187f0e41fd6b41b2d;hb=88174b1a82d196dcf55edcae73c132522d083c19;hp=dc6fc62c3d23b1d5cf1873173ccc01750cf773df;hpb=9de4779e206628d8c7c9ae76785bfe825b5267d5;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/auth/AuthManagerTest.php b/tests/phpunit/includes/auth/AuthManagerTest.php index dc6fc62c3d..f57db11b23 100644 --- a/tests/phpunit/includes/auth/AuthManagerTest.php +++ b/tests/phpunit/includes/auth/AuthManagerTest.php @@ -6,6 +6,7 @@ use MediaWiki\Session\SessionInfo; use MediaWiki\Session\UserInfo; use Psr\Log\LogLevel; use StatusValue; +use Wikimedia\ScopedCallback; /** * @group AuthManager @@ -184,7 +185,7 @@ class AuthManagerTest extends \MediaWikiTestCase { $rProp = new \ReflectionProperty( AuthManager::class, 'instance' ); $rProp->setAccessible( true ); $old = $rProp->getValue(); - $cb = new \ScopedCallback( [ $rProp, 'setValue' ], [ $old ] ); + $cb = new ScopedCallback( [ $rProp, 'setValue' ], [ $old ] ); $rProp->setValue( null ); $singleton = AuthManager::singleton(); @@ -202,11 +203,11 @@ class AuthManagerTest extends \MediaWikiTestCase { list( $provider, $reset ) = $this->getMockSessionProvider( false ); $this->assertFalse( $this->manager->canAuthenticateNow() ); - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); list( $provider, $reset ) = $this->getMockSessionProvider( true ); $this->assertTrue( $this->manager->canAuthenticateNow() ); - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); } public function testNormalizeUsername() { @@ -385,7 +386,7 @@ class AuthManagerTest extends \MediaWikiTestCase { $this->unhook( 'SecuritySensitiveOperationStatus' ); } - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); } public function onSecuritySensitiveOperationStatus( &$status, $operation, $session, $time ) { @@ -585,7 +586,7 @@ class AuthManagerTest extends \MediaWikiTestCase { $this->initializeManager(); $context = \RequestContext::getMain(); - $reset = new \ScopedCallback( [ $context, 'setLanguage' ], [ $context->getLanguage() ] ); + $reset = new ScopedCallback( [ $context, 'setLanguage' ], [ $context->getLanguage() ] ); $context->setLanguage( 'de' ); $this->setMwGlobals( 'wgContLang', \Language::factory( 'zh' ) ); @@ -694,7 +695,6 @@ class AuthManagerTest extends \MediaWikiTestCase { $ex->getMessage() ); } - } public function testBeginAuthentication() { @@ -712,7 +712,7 @@ class AuthManagerTest extends \MediaWikiTestCase { } $this->unhook( 'UserLoggedIn' ); $this->assertNull( $this->request->getSession()->getSecret( 'AuthManager::authnState' ) ); - \ScopedCallback::consume( $reset ); + ScopedCallback::consume( $reset ); $this->initializeManager( true ); // CreatedAccountAuthenticationRequest @@ -1449,11 +1449,11 @@ class AuthManagerTest extends \MediaWikiTestCase { ]; $block = new \Block( $blockOptions ); $block->insert(); - $scopeVariable = new \ScopedCallback( [ $block, 'delete' ] ); + $scopeVariable = new ScopedCallback( [ $block, 'delete' ] ); $status = $this->manager->checkAccountCreatePermissions( new \User ); $this->assertFalse( $status->isOK() ); $this->assertTrue( $status->hasMessage( 'cantcreateaccount-range-text' ) ); - \ScopedCallback::consume( $scopeVariable ); + ScopedCallback::consume( $scopeVariable ); $this->setMwGlobals( [ 'wgEnableDnsBlacklist' => true, @@ -3264,7 +3264,6 @@ class AuthManagerTest extends \MediaWikiTestCase { $this->manager->removeAuthenticationSessionData( null ); $this->assertNull( $this->manager->getAuthenticationSessionData( 'foo' ) ); $this->assertNull( $this->manager->getAuthenticationSessionData( 'bar' ) ); - } public function testCanLinkAccounts() {