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