Merge "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git] / tests / phpunit / includes / auth / AuthManagerTest.php
index 5cf93c9..fc6f688 100644 (file)
@@ -3,6 +3,7 @@
 namespace MediaWiki\Auth;
 
 use Config;
+use MediaWiki\Block\DatabaseBlock;
 use MediaWiki\Session\SessionInfo;
 use MediaWiki\Session\UserInfo;
 use Psr\Log\LoggerInterface;
@@ -1430,7 +1431,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
                        \TestUser::setPasswordForUser( $user, 'UTBlockeePassword' );
                        $user->saveSettings();
                }
-               $oldBlock = \Block::newFromTarget( 'UTBlockee' );
+               $oldBlock = DatabaseBlock::newFromTarget( 'UTBlockee' );
                if ( $oldBlock ) {
                        // An old block will prevent our new one from saving.
                        $oldBlock->delete();
@@ -1443,8 +1444,9 @@ class AuthManagerTest extends \MediaWikiTestCase {
                        'expiry' => time() + 100500,
                        'createAccount' => true,
                ];
-               $block = new \Block( $blockOptions );
+               $block = new DatabaseBlock( $blockOptions );
                $block->insert();
+               $this->resetServices();
                $status = $this->manager->checkAccountCreatePermissions( $user );
                $this->assertFalse( $status->isOK() );
                $this->assertTrue( $status->hasMessage( 'cantcreateaccount-text' ) );
@@ -1456,7 +1458,7 @@ class AuthManagerTest extends \MediaWikiTestCase {
                        'expiry' => time() + 100500,
                        'createAccount' => true,
                ];
-               $block = new \Block( $blockOptions );
+               $block = new DatabaseBlock( $blockOptions );
                $block->insert();
                $scopeVariable = new ScopedCallback( [ $block, 'delete' ] );
                $status = $this->manager->checkAccountCreatePermissions( new \User );
@@ -1471,12 +1473,12 @@ class AuthManagerTest extends \MediaWikiTestCase {
                        ],
                        'wgProxyWhitelist' => [],
                ] );
-               $this->overrideMwServices();
+               $this->resetServices();
                $status = $this->manager->checkAccountCreatePermissions( new \User );
                $this->assertFalse( $status->isOK() );
                $this->assertTrue( $status->hasMessage( 'sorbs_create_account_reason' ) );
                $this->setMwGlobals( 'wgProxyWhitelist', [ '127.0.0.1' ] );
-               $this->overrideMwServices();
+               $this->resetServices();
                $status = $this->manager->checkAccountCreatePermissions( new \User );
                $this->assertTrue( $status->isGood() );
        }
@@ -2364,6 +2366,8 @@ class AuthManagerTest extends \MediaWikiTestCase {
                $this->mergeMwGlobalArrayValue( 'wgObjectCaches',
                        [ __METHOD__ => [ 'class' => 'HashBagOStuff' ] ] );
                $this->setMwGlobals( [ 'wgMainCacheType' => __METHOD__ ] );
+               // Supply services with updated globals
+               $this->resetServices();
 
                // Set up lots of mocks...
                $mocks = [];