Merge "maintenance: Script to rename titles for Unicode uppercasing changes"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiBaseTest.php
index 0dc64df..6a44ff3 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use MediaWiki\Block\DatabaseBlock;
+use MediaWiki\MediaWikiServices;
 use Wikimedia\TestingAccessWrapper;
 
 /**
@@ -643,7 +645,7 @@ class ApiBaseTest extends ApiTestCase {
                                        ApiBase::PARAM_ISMULTI => true,
                                        ApiBase::PARAM_TYPE => 'namespace',
                                ],
-                               MWNamespace::getValidNamespaces(),
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces(),
                                [],
                        ],
                        // PARAM_ALL is ignored with namespace types.
@@ -654,7 +656,7 @@ class ApiBaseTest extends ApiTestCase {
                                        ApiBase::PARAM_TYPE => 'namespace',
                                        ApiBase::PARAM_ALL => false,
                                ],
-                               MWNamespace::getValidNamespaces(),
+                               MediaWikiServices::getInstance()->getNamespaceInfo()->getValidNamespaces(),
                                [],
                        ],
                        'Namespace with wildcard "x"' => [
@@ -1324,7 +1326,7 @@ class ApiBaseTest extends ApiTestCase {
 
                // Has a blocked $user, so special block handling
                $user = $this->getMutableTestUser()->getUser();
-               $block = new \Block( [
+               $block = new DatabaseBlock( [
                        'address' => $user->getName(),
                        'user' => $user->getID(),
                        'by' => $this->getTestSysop()->getUser()->getId(),
@@ -1332,7 +1334,10 @@ class ApiBaseTest extends ApiTestCase {
                        'expiry' => time() + 100500,
                ] );
                $block->insert();
-               $blockinfo = [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ];
+               $userInfoTrait = TestingAccessWrapper::newFromObject(
+                       $this->getMockForTrait( ApiBlockInfoTrait::class )
+               );
+               $blockinfo = [ 'blockinfo' => $userInfoTrait->getBlockDetails( $block ) ];
 
                $expect = Status::newGood();
                $expect->fatal( ApiMessage::create( 'apierror-blocked', 'blocked', $blockinfo ) );
@@ -1379,7 +1384,7 @@ class ApiBaseTest extends ApiTestCase {
 
                // Has a blocked $user, so special block handling
                $user = $this->getMutableTestUser()->getUser();
-               $block = new \Block( [
+               $block = new DatabaseBlock( [
                        'address' => $user->getName(),
                        'user' => $user->getID(),
                        'by' => $this->getTestSysop()->getUser()->getId(),
@@ -1387,7 +1392,10 @@ class ApiBaseTest extends ApiTestCase {
                        'expiry' => time() + 100500,
                ] );
                $block->insert();
-               $blockinfo = [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $block ) ];
+               $userInfoTrait = TestingAccessWrapper::newFromObject(
+                       $this->getObjectForTrait( ApiBlockInfoTrait::class )
+               );
+               $blockinfo = [ 'blockinfo' => $userInfoTrait->getBlockDetails( $block ) ];
 
                $expect = Status::newGood();
                $expect->fatal( ApiMessage::create( 'apierror-blocked', 'blocked', $blockinfo ) );