X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FLinkerTest.php;h=9889b0863ee0f62a8e1e1ac263d31722a5e9905a;hb=5cb425a62b6eba0161702fe49568d137d7b91c91;hp=b605f08f1679e11121460c3c862edac840c8a860;hpb=966fb8da62a9439476ada380dfc3c1a2672446ec;p=lhc%2Fweb%2Fwiklou.git
diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php
index b605f08f16..9889b0863e 100644
--- a/tests/phpunit/includes/LinkerTest.php
+++ b/tests/phpunit/includes/LinkerTest.php
@@ -28,38 +28,52 @@ class LinkerTest extends MediaWikiLangTestCase {
### ANONYMOUS USER ########################################
array(
- 'JohnDoe',
+ 'JohnDoe',
0, 'JohnDoe', false,
),
array(
- '::1',
+ '::1',
0, '::1', false,
'Anonymous with pretty IPv6'
),
array(
- '::1',
+ '::1',
0, '0:0:0:0:0:0:0:1', false,
'Anonymous with almost pretty IPv6'
),
array(
- '::1',
+ '::1',
0, '0000:0000:0000:0000:0000:0000:0000:0001', false,
'Anonymous with full IPv6'
),
array(
- 'AlternativeUsername',
+ 'AlternativeUsername',
0, '::1', 'AlternativeUsername',
'Anonymous with pretty IPv6 and an alternative username'
),
# IPV4
array(
- '127.0.0.1',
+ '127.0.0.1',
0, '127.0.0.1', false,
'Anonymous with IPv4'
),
array(
- 'AlternativeUsername',
+ 'AlternativeUsername',
0, '127.0.0.1', 'AlternativeUsername',
'Anonymous with IPv4 and an alternative username'
),
@@ -68,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