Remove messages.inc, rebuildLanguage.php, writeMessagesArray.inc
[mediawiki.git] / tests / phpunit / includes / LinkerTest.php
blob110cbacfe900567176477a70add1c9bc56235bc0
1 <?php
3 class LinkerTest extends MediaWikiLangTestCase {
5 /**
6 * @dataProvider provideCasesForUserLink
7 * @covers Linker::userLink
8 */
9 public function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg = '' ) {
10 $this->setMwGlobals( array(
11 'wgArticlePath' => '/wiki/$1',
12 'wgWellFormedXml' => true,
13 ) );
15 $this->assertEquals( $expected,
16 Linker::userLink( $userId, $userName, $altUserName, $msg )
20 public static function provideCasesForUserLink() {
21 # Format:
22 # - expected
23 # - userid
24 # - username
25 # - optional altUserName
26 # - optional message
27 return array(
29 ### ANONYMOUS USER ########################################
30 array(
31 '<a href="/wiki/Special:Contributions/JohnDoe" '
32 . 'title="Special:Contributions/JohnDoe" '
33 . 'class="mw-userlink mw-anonuserlink">JohnDoe</a>',
34 0, 'JohnDoe', false,
36 array(
37 '<a href="/wiki/Special:Contributions/::1" '
38 . 'title="Special:Contributions/::1" '
39 . 'class="mw-userlink mw-anonuserlink">::1</a>',
40 0, '::1', false,
41 'Anonymous with pretty IPv6'
43 array(
44 '<a href="/wiki/Special:Contributions/0:0:0:0:0:0:0:1" '
45 . 'title="Special:Contributions/0:0:0:0:0:0:0:1" '
46 . 'class="mw-userlink mw-anonuserlink">::1</a>',
47 0, '0:0:0:0:0:0:0:1', false,
48 'Anonymous with almost pretty IPv6'
50 array(
51 '<a href="/wiki/Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
52 . 'title="Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
53 . 'class="mw-userlink mw-anonuserlink">::1</a>',
54 0, '0000:0000:0000:0000:0000:0000:0000:0001', false,
55 'Anonymous with full IPv6'
57 array(
58 '<a href="/wiki/Special:Contributions/::1" '
59 . 'title="Special:Contributions/::1" '
60 . 'class="mw-userlink mw-anonuserlink">AlternativeUsername</a>',
61 0, '::1', 'AlternativeUsername',
62 'Anonymous with pretty IPv6 and an alternative username'
65 # IPV4
66 array(
67 '<a href="/wiki/Special:Contributions/127.0.0.1" '
68 . 'title="Special:Contributions/127.0.0.1" '
69 . 'class="mw-userlink mw-anonuserlink">127.0.0.1</a>',
70 0, '127.0.0.1', false,
71 'Anonymous with IPv4'
73 array(
74 '<a href="/wiki/Special:Contributions/127.0.0.1" '
75 . 'title="Special:Contributions/127.0.0.1" '
76 . 'class="mw-userlink mw-anonuserlink">AlternativeUsername</a>',
77 0, '127.0.0.1', 'AlternativeUsername',
78 'Anonymous with IPv4 and an alternative username'
81 ### Regular user ##########################################
82 # TODO!