From: Bartosz Dziewoński Date: Tue, 10 Jun 2014 19:37:37 +0000 (+0200) Subject: LinkerTest: A bunch of tests for Linker::formatComment and friends X-Git-Tag: 1.31.0-rc.0~15415^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=63ce38567c6197ff397fadc336f1d6af859ee343;p=lhc%2Fweb%2Fwiklou.git LinkerTest: A bunch of tests for Linker::formatComment and friends Change-Id: Ie805d2945ddc1596545ef3f22d32b429caca8a27 --- diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index 110cbacfe9..9889b0863e 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -82,4 +82,105 @@ class LinkerTest extends MediaWikiLangTestCase { # TODO! ); } + + /** + * @dataProvider provideCasesForFormatComment + * @covers Linker::formatComment + * @covers Linker::formatAutocomments + * @covers Linker::formatLinksInComment + */ + public function testFormatComment( $expected, $comment, $title = false, $local = false ) { + $this->setMwGlobals( array( + 'wgArticlePath' => '/wiki/$1', + 'wgWellFormedXml' => true, + ) ); + + if ( $title === false ) { + // We need a page title that exists + $title = Title::newFromText( 'Special:BlankPage' ); + } + + $this->assertEquals( + $expected, + Linker::formatComment( $comment, $title, $local ) + ); + } + + public static function provideCasesForFormatComment() { + return array( + // Linker::formatComment + array( + 'a<script>b', + 'a