X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FLinkerTest.php;h=823c9330a664e80bcf6b9e96305cc2a2c2129dd4;hb=dd740a65dc010dc44318ae14e465166fbbb24da4;hp=72114e963e05cdf0283e9e4aa5abcd3c371f8c84;hpb=1d9c11aba4b2b91018db373bfb618ee24a2eeac5;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index 72114e963e..823c9330a6 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -1,5 +1,9 @@ →‎autocomment2: ', + '→‎autocomment: multiple? →‎autocomment2: ', "/* autocomment */ multiple? /* autocomment2 */ ", ), + array( + '→‎autocomment containing /*: T70361', + "/* autocomment containing /* */ T70361" + ), array( '→‎autocomment', "/* autocomment */", @@ -185,4 +193,54 @@ class LinkerTest extends MediaWikiLangTestCase { ), ); } + + /** + * @covers Linker::formatLinksInComment + * @dataProvider provideCasesForFormatLinksInComment + */ + public function testFormatLinksInComment( $expected, $input, $wiki ) { + + $conf = new SiteConfiguration(); + $conf->settings = array( + 'wgServer' => array( + 'enwiki' => '//en.example.org' + ), + 'wgArticlePath' => array( + 'enwiki' => '/w/$1', + ), + ); + $conf->suffixes = array( 'wiki' ); + $this->setMwGlobals( array( + 'wgScript' => '/wiki/index.php', + 'wgArticlePath' => '/wiki/$1', + 'wgWellFormedXml' => true, + 'wgCapitalLinks' => true, + 'wgConf' => $conf, + ) ); + + $this->assertEquals( + $expected, + Linker::formatLinksInComment( $input, Title::newFromText( 'Special:BlankPage' ), false, $wiki ) + ); + } + + public static function provideCasesForFormatLinksInComment() { + return array( + array( + 'foo bar Special:BlankPage', + 'foo bar [[Special:BlankPage]]', + null, + ), + array( + 'Foo\'bar', + "[[Foo'bar]]", + 'enwiki', + ), + array( + 'foo bar Special:BlankPage', + 'foo bar [[Special:BlankPage]]', + 'enwiki', + ), + ); + } }