*/
private $linkCache;
+ /**
+ * @var NamespaceInfo
+ */
+ private $nsInfo;
+
public function setUp() {
parent::setUp();
- $this->titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
- $this->linkCache = MediaWikiServices::getInstance()->getLinkCache();
+
+ $services = MediaWikiServices::getInstance();
+ $this->titleFormatter = $services->getTitleFormatter();
+ $this->linkCache = $services->getLinkCache();
+ $this->nsInfo = $services->getNamespaceInfo();
}
public static function provideCreateFromLegacyOptions() {
* @dataProvider provideCreateFromLegacyOptions
*/
public function testCreateFromLegacyOptions( $options, $func, $val ) {
- $factory = new LinkRendererFactory( $this->titleFormatter, $this->linkCache );
+ $factory =
+ new LinkRendererFactory( $this->titleFormatter, $this->linkCache, $this->nsInfo );
$linkRenderer = $factory->createFromLegacyOptions(
$options
);
}
public function testCreate() {
- $factory = new LinkRendererFactory( $this->titleFormatter, $this->linkCache );
+ $factory =
+ new LinkRendererFactory( $this->titleFormatter, $this->linkCache, $this->nsInfo );
$this->assertInstanceOf( LinkRenderer::class, $factory->create() );
}
public function testCreateForUser() {
/** @var PHPUnit_Framework_MockObject_MockObject|User $user */
- $user = $this->getMock( User::class, [ 'getStubThreshold' ] );
+ $user = $this->getMockBuilder( User::class )
+ ->setMethods( [ 'getStubThreshold' ] )->getMock();
$user->expects( $this->once() )
->method( 'getStubThreshold' )
->willReturn( 15 );
- $factory = new LinkRendererFactory( $this->titleFormatter, $this->linkCache );
+ $factory =
+ new LinkRendererFactory( $this->titleFormatter, $this->linkCache, $this->nsInfo );
$linkRenderer = $factory->createForUser( $user );
$this->assertInstanceOf( LinkRenderer::class, $linkRenderer );
$this->assertEquals( 15, $linkRenderer->getStubThreshold() );