3 class LinkerTest
extends MediaWikiLangTestCase
{
6 * @dataProvider provideCasesForUserLink
7 * @covers Linker::userLink
9 function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg = '' ) {
10 $this->setMwGlobals( array(
11 'wgArticlePath' => '/wiki/$1',
12 'wgWellFormedXml' => true,
15 $this->assertEquals( $expected,
16 Linker
::userLink( $userId, $userName, $altUserName, $msg )
20 public static function provideCasesForUserLink() {
25 # - optional altUserName
29 ### ANONYMOUS USER ########################################
31 '<a href="/wiki/Special:Contributions/JohnDoe" title="Special:Contributions/JohnDoe" class="mw-userlink">JohnDoe</a>',
35 '<a href="/wiki/Special:Contributions/::1" title="Special:Contributions/::1" class="mw-userlink">::1</a>',
37 'Anonymous with pretty IPv6'
40 '<a href="/wiki/Special:Contributions/0:0:0:0:0:0:0:1" title="Special:Contributions/0:0:0:0:0:0:0:1" class="mw-userlink">::1</a>',
41 0, '0:0:0:0:0:0:0:1', false,
42 'Anonymous with almost pretty IPv6'
45 '<a href="/wiki/Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" title="Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" class="mw-userlink">::1</a>',
46 0, '0000:0000:0000:0000:0000:0000:0000:0001', false,
47 'Anonymous with full IPv6'
50 '<a href="/wiki/Special:Contributions/::1" title="Special:Contributions/::1" class="mw-userlink">AlternativeUsername</a>',
51 0, '::1', 'AlternativeUsername',
52 'Anonymous with pretty IPv6 and an alternative username'
57 '<a href="/wiki/Special:Contributions/127.0.0.1" title="Special:Contributions/127.0.0.1" class="mw-userlink">127.0.0.1</a>',
58 0, '127.0.0.1', false,
62 '<a href="/wiki/Special:Contributions/127.0.0.1" title="Special:Contributions/127.0.0.1" class="mw-userlink">AlternativeUsername</a>',
63 0, '127.0.0.1', 'AlternativeUsername',
64 'Anonymous with IPv4 and an alternative username'
67 ### Regular user ##########################################