X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiQuerySiteinfoTest.php;h=0a2558a227b91346af5c65dd2911bd99c0c053a2;hb=47464abb4f2f209f4c72e8af40056f508d1a70de;hp=55f4a330ce87c3c67f826fa9366d76e3d4a579ea;hpb=b1b89784f6df33d02d91401eaacc4aeab6bbedee;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php b/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php index 55f4a330ce..0a2558a227 100644 --- a/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php +++ b/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php @@ -210,15 +210,16 @@ class ApiQuerySiteinfoTest extends ApiTestCase { $this->setExpectedApiException( 'apierror-siteinfo-includealldenied' ); } - $mockLB = $this->getMockBuilder( LoadBalancer::class ) - ->disableOriginalConstructor() - ->setMethods( [ 'getMaxLag', 'getLagTimes', 'getServerName', '__destruct' ] ) - ->getMock(); + $mockLB = $this->createMock( LoadBalancer::class ); $mockLB->method( 'getMaxLag' )->willReturn( [ null, 7, 1 ] ); $mockLB->method( 'getLagTimes' )->willReturn( [ 5, 7 ] ); $mockLB->method( 'getServerName' )->will( $this->returnValueMap( [ [ 0, 'apple' ], [ 1, 'carrot' ] ] ) ); + $mockLB->method( 'getLocalDomainID' )->willReturn( 'testdomain' ); + $mockLB->expects( $this->never() )->method( $this->anythingBut( + 'getMaxLag', 'getLagTimes', 'getServerName', 'getLocalDomainID', '__destruct' + ) ); $this->setService( 'DBLoadBalancer', $mockLB ); $this->setMwGlobals( 'wgShowHostnames', $showHostnames ); @@ -571,22 +572,19 @@ class ApiQuerySiteinfoTest extends ApiTestCase { } public function testExtensionTags() { - global $wgParser; - $expected = array_map( function ( $tag ) { return "<$tag>"; }, - $wgParser->getTags() + MediaWikiServices::getInstance()->getParser()->getTags() ); $this->assertSame( $expected, $this->doQuery( 'extensiontags' ) ); } public function testFunctionHooks() { - global $wgParser; - - $this->assertSame( $wgParser->getFunctionHooks(), $this->doQuery( 'functionhooks' ) ); + $this->assertSame( MediaWikiServices::getInstance()->getParser()->getFunctionHooks(), + $this->doQuery( 'functionhooks' ) ); } public function testVariables() {