$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 );
}
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() {
- $this->assertSame( MagicWord::getVariableIDs(), $this->doQuery( 'variables' ) );
+ $this->assertSame(
+ MediaWikiServices::getInstance()->getMagicWordFactory()->getVariableIDs(),
+ $this->doQuery( 'variables' )
+ );
}
public function testProtocols() {