X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FLinkerTest.php;h=b8aecc05a5260b4c240275ce0cf83e2a841e31a6;hb=733704ed8248f71dfb982d22799104a976d1ada4;hp=f4844f89bb4ec12f96bc89ffa7933f3e094ddef0;hpb=97c5bc0a1ea20ed4f6c3e26b97dcd5d6f360a8ce;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index f4844f89bb..b8aecc05a5 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -1,11 +1,9 @@ Special:BlankPage', 'foo bar [[Special:BlankPage]]', null, ], + [ + 'Special:BlankPage', + '[[ :Special:BlankPage]]', + null, + ], [ 'Foo\'bar', "[[Foo'bar]]", @@ -312,43 +315,43 @@ class LinkerTest extends MediaWikiLangTestCase { 'enwiki', ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } public static function provideLinkBeginHook() { - // @codingStandardsIgnoreStart Generic.Files.LineLength + // phpcs:disable Generic.Files.LineLength return [ // Modify $html [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $html = 'foobar'; }, 'foobar' ], // Modify $attribs [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $attribs['bar'] = 'baz'; }, 'Special:BlankPage' ], // Modify $query [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $query['bar'] = 'baz'; }, 'Special:BlankPage' ], // Force HTTP $options [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $options = [ 'http' ]; }, 'Special:BlankPage' ], // Force 'forcearticlepath' in $options [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $options = [ 'forcearticlepath' ]; $query['foo'] = 'bar'; }, @@ -356,14 +359,14 @@ class LinkerTest extends MediaWikiLangTestCase { ], // Abort early [ - function( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { + function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) { $ret = 'foobar'; return false; }, 'foobar' ], ]; - // @codingStandardsIgnoreEnd + // phpcs:enable } /** @@ -371,6 +374,7 @@ class LinkerTest extends MediaWikiLangTestCase { * @dataProvider provideLinkBeginHook */ public function testLinkBeginHook( $callback, $expected ) { + $this->hideDeprecated( 'LinkBegin hook (used in hook-LinkBegin-closure)' ); $this->setMwGlobals( [ 'wgArticlePath' => '/wiki/$1', 'wgServer' => '//example.org', @@ -418,6 +422,7 @@ class LinkerTest extends MediaWikiLangTestCase { * @dataProvider provideLinkEndHook */ public function testLinkEndHook( $callback, $expected ) { + $this->hideDeprecated( 'LinkEnd hook (used in hook-LinkEnd-closure)' ); $this->setMwGlobals( [ 'wgArticlePath' => '/wiki/$1', ] ); @@ -428,54 +433,4 @@ class LinkerTest extends MediaWikiLangTestCase { $out = Linker::link( $title ); $this->assertEquals( $expected, $out ); } - - /** - * @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 ) - ); - } }