-
- /**
- * @covers Linker::getLinkColour
- */
- public function testGetLinkColour() {
- $this->hideDeprecated( 'Linker::getLinkColour' );
- $linkCache = MediaWikiServices::getInstance()->getLinkCache();
- $foobarTitle = Title::makeTitle( NS_MAIN, 'FooBar' );
- $redirectTitle = Title::makeTitle( NS_MAIN, 'Redirect' );
- $userTitle = Title::makeTitle( NS_USER, 'Someuser' );
- $linkCache->addGoodLinkObj(
- 1, // id
- $foobarTitle,
- 10, // len
- 0 // redir
- );
- $linkCache->addGoodLinkObj(
- 2, // id
- $redirectTitle,
- 10, // len
- 1 // redir
- );
-
- $linkCache->addGoodLinkObj(
- 3, // id
- $userTitle,
- 10, // len
- 0 // redir
- );
-
- $this->assertEquals(
- '',
- Linker::getLinkColour( $foobarTitle, 0 )
- );
-
- $this->assertEquals(
- 'stub',
- Linker::getLinkColour( $foobarTitle, 20 )
- );
-
- $this->assertEquals(
- 'mw-redirect',
- Linker::getLinkColour( $redirectTitle, 0 )
- );
-
- $this->assertEquals(
- '',
- Linker::getLinkColour( $userTitle, 20 )
- );
- }