Merge "rdbms: avoid LoadBalancer::getConnection waste when using $groups"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiEditPageTest.php
index aeb829d..d2762e0 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use MediaWiki\Block\DatabaseBlock;
+
 /**
  * Tests for MediaWiki api.php?action=edit.
  *
@@ -408,10 +410,10 @@ class ApiEditPageTest extends ApiTestCase {
                $count++;
 
                /*
-               * T43990: if the target page has a newer revision than the redirect, then editing the
-               * redirect while specifying 'redirect' and *not* specifying 'basetimestamp' erroneously
-               * caused an edit conflict to be detected.
-               */
+                * T43990: if the target page has a newer revision than the redirect, then editing the
+                * redirect while specifying 'redirect' and *not* specifying 'basetimestamp' erroneously
+                * caused an edit conflict to be detected.
+                */
 
                // assume NS_HELP defaults to wikitext
                $name = "Help:ApiEditPageTest_testEditConflict_redirect_T43990_$count";
@@ -1474,9 +1476,9 @@ class ApiEditPageTest extends ApiTestCase {
        public function testEditWhileBlocked() {
                $name = 'Help:' . ucfirst( __FUNCTION__ );
 
-               $this->assertNull( Block::newFromTarget( '127.0.0.1' ), 'Sanity check' );
+               $this->assertNull( DatabaseBlock::newFromTarget( '127.0.0.1' ), 'Sanity check' );
 
-               $block = new Block( [
+               $block = new DatabaseBlock( [
                        'address' => self::$users['sysop']->getUser()->getName(),
                        'by' => self::$users['sysop']->getUser()->getId(),
                        'reason' => 'Capriciousness',
@@ -1495,7 +1497,7 @@ class ApiEditPageTest extends ApiTestCase {
                        $this->fail( 'Expected exception not thrown' );
                } catch ( ApiUsageException $ex ) {
                        $this->assertSame( 'You have been blocked from editing.', $ex->getMessage() );
-                       $this->assertNotNull( Block::newFromTarget( '127.0.0.1' ), 'Autoblock spread' );
+                       $this->assertNotNull( DatabaseBlock::newFromTarget( '127.0.0.1' ), 'Autoblock spread' );
                } finally {
                        $block->delete();
                        self::$users['sysop']->getUser()->clearInstanceCache();