3 class LinkerTest
extends MediaWikiLangTestCase
{
6 * @dataProvider provideCasesForUserLink
7 * @cover Linker::userLink
9 function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg='' ) {
10 $this->setMwGlobals( array(
11 'wgArticlePath' => '/wiki/$1',
14 $this->assertEquals( $expected,
15 Linker
::userLink( $userId, $userName, $altUserName, $msg )
19 function provideCasesForUserLink() {
24 # - optional altUserName
28 ### ANONYMOUS USER ########################################
30 '<a href="/wiki/Special:Contributions/JohnDoe" title="Special:Contributions/JohnDoe" class="mw-userlink">JohnDoe</a>',
34 '<a href="/wiki/Special:Contributions/::1" title="Special:Contributions/::1" class="mw-userlink">::1</a>',
36 'Anonymous with pretty IPv6'
39 '<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>',
40 0, '0:0:0:0:0:0:0:1', false,
41 'Anonymous with almost pretty IPv6'
44 '<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>',
45 0, '0000:0000:0000:0000:0000:0000:0000:0001', false,
46 'Anonymous with full IPv6'
49 '<a href="/wiki/Special:Contributions/::1" title="Special:Contributions/::1" class="mw-userlink">AlternativeUsername</a>',
50 0, '::1', 'AlternativeUsername',
51 'Anonymous with pretty IPv6 and an alternative username'
56 '<a href="/wiki/Special:Contributions/127.0.0.1" title="Special:Contributions/127.0.0.1" class="mw-userlink">127.0.0.1</a>',
57 0, '127.0.0.1', false,
61 '<a href="/wiki/Special:Contributions/127.0.0.1" title="Special:Contributions/127.0.0.1" class="mw-userlink">AlternativeUsername</a>',
62 0, '127.0.0.1', 'AlternativeUsername',
63 'Anonymous with IPv4 and an alternative username'
66 ### Regular user ##########################################