Remove hard deprecation of PasswordPolicyChecks::checkPopularPasswordBlacklist
[lhc/web/wiklou.git] / tests / phpunit / includes / LinkerTest.php
1 <?php
2
3 /**
4 * @group Database
5 */
6 class LinkerTest extends MediaWikiLangTestCase {
7 /**
8 * @dataProvider provideCasesForUserLink
9 * @covers Linker::userLink
10 */
11 public function testUserLink( $expected, $userId, $userName, $altUserName = false, $msg = '' ) {
12 $this->setMwGlobals( [
13 'wgArticlePath' => '/wiki/$1',
14 ] );
15
16 // We'd also test the warning, but injecting a mock logger into a static method is tricky.
17 if ( !$userName ) {
18 Wikimedia\suppressWarnings();
19 }
20 $actual = Linker::userLink( $userId, $userName, $altUserName );
21 if ( !$userName ) {
22 Wikimedia\restoreWarnings();
23 }
24
25 $this->assertEquals( $expected, $actual, $msg );
26 }
27
28 public static function provideCasesForUserLink() {
29 # Format:
30 # - expected
31 # - userid
32 # - username
33 # - optional altUserName
34 # - optional message
35 return [
36 # Empty name (T222529)
37 'Empty username, userid 0' => [ '(no username available)', 0, '' ],
38 'Empty username, userid > 0' => [ '(no username available)', 73, '' ],
39
40 'false instead of username' => [ '(no username available)', 73, false ],
41 'null instead of username' => [ '(no username available)', 0, null ],
42
43 # ## ANONYMOUS USER ########################################
44 [
45 '<a href="/wiki/Special:Contributions/JohnDoe" '
46 . 'class="mw-userlink mw-anonuserlink" '
47 . 'title="Special:Contributions/JohnDoe"><bdi>JohnDoe</bdi></a>',
48 0, 'JohnDoe', false,
49 ],
50 [
51 '<a href="/wiki/Special:Contributions/::1" '
52 . 'class="mw-userlink mw-anonuserlink" '
53 . 'title="Special:Contributions/::1"><bdi>::1</bdi></a>',
54 0, '::1', false,
55 'Anonymous with pretty IPv6'
56 ],
57 [
58 '<a href="/wiki/Special:Contributions/0:0:0:0:0:0:0:1" '
59 . 'class="mw-userlink mw-anonuserlink" '
60 . 'title="Special:Contributions/0:0:0:0:0:0:0:1"><bdi>::1</bdi></a>',
61 0, '0:0:0:0:0:0:0:1', false,
62 'Anonymous with almost pretty IPv6'
63 ],
64 [
65 '<a href="/wiki/Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001" '
66 . 'class="mw-userlink mw-anonuserlink" '
67 . 'title="Special:Contributions/0000:0000:0000:0000:0000:0000:0000:0001"><bdi>::1</bdi></a>',
68 0, '0000:0000:0000:0000:0000:0000:0000:0001', false,
69 'Anonymous with full IPv6'
70 ],
71 [
72 '<a href="/wiki/Special:Contributions/::1" '
73 . 'class="mw-userlink mw-anonuserlink" '
74 . 'title="Special:Contributions/::1"><bdi>AlternativeUsername</bdi></a>',
75 0, '::1', 'AlternativeUsername',
76 'Anonymous with pretty IPv6 and an alternative username'
77 ],
78
79 # IPV4
80 [
81 '<a href="/wiki/Special:Contributions/127.0.0.1" '
82 . 'class="mw-userlink mw-anonuserlink" '
83 . 'title="Special:Contributions/127.0.0.1"><bdi>127.0.0.1</bdi></a>',
84 0, '127.0.0.1', false,
85 'Anonymous with IPv4'
86 ],
87 [
88 '<a href="/wiki/Special:Contributions/127.0.0.1" '
89 . 'class="mw-userlink mw-anonuserlink" '
90 . 'title="Special:Contributions/127.0.0.1"><bdi>AlternativeUsername</bdi></a>',
91 0, '127.0.0.1', 'AlternativeUsername',
92 'Anonymous with IPv4 and an alternative username'
93 ],
94
95 # ## Regular user ##########################################
96 # TODO!
97 ];
98 }
99
100 /**
101 * @dataProvider provideUserToolLinks
102 * @covers Linker::userToolLinks
103 * @param string $expected
104 * @param int $userId
105 * @param string $userText
106 */
107 public function testUserToolLinks( $expected, $userId, $userText ) {
108 // We'd also test the warning, but injecting a mock logger into a static method is tricky.
109 if ( $userText === '' ) {
110 Wikimedia\suppressWarnings();
111 }
112 $actual = Linker::userToolLinks( $userId, $userText );
113 if ( $userText === '' ) {
114 Wikimedia\restoreWarnings();
115 }
116
117 $this->assertSame( $expected, $actual );
118 }
119
120 public static function provideUserToolLinks() {
121 return [
122 // Empty name (T222529)
123 'Empty username, userid 0' => [ ' (no username available)', 0, '' ],
124 'Empty username, userid > 0' => [ ' (no username available)', 73, '' ],
125 ];
126 }
127
128 /**
129 * @dataProvider provideUserTalkLink
130 * @covers Linker::userTalkLink
131 * @param string $expected
132 * @param int $userId
133 * @param string $userText
134 */
135 public function testUserTalkLink( $expected, $userId, $userText ) {
136 // We'd also test the warning, but injecting a mock logger into a static method is tricky.
137 if ( $userText === '' ) {
138 Wikimedia\suppressWarnings();
139 }
140 $actual = Linker::userTalkLink( $userId, $userText );
141 if ( $userText === '' ) {
142 Wikimedia\restoreWarnings();
143 }
144
145 $this->assertSame( $expected, $actual );
146 }
147
148 public static function provideUserTalkLink() {
149 return [
150 // Empty name (T222529)
151 'Empty username, userid 0' => [ '(no username available)', 0, '' ],
152 'Empty username, userid > 0' => [ '(no username available)', 73, '' ],
153 ];
154 }
155
156 /**
157 * @dataProvider provideBlockLink
158 * @covers Linker::blockLink
159 * @param string $expected
160 * @param int $userId
161 * @param string $userText
162 */
163 public function testBlockLink( $expected, $userId, $userText ) {
164 // We'd also test the warning, but injecting a mock logger into a static method is tricky.
165 if ( $userText === '' ) {
166 Wikimedia\suppressWarnings();
167 }
168 $actual = Linker::blockLink( $userId, $userText );
169 if ( $userText === '' ) {
170 Wikimedia\restoreWarnings();
171 }
172
173 $this->assertSame( $expected, $actual );
174 }
175
176 public static function provideBlockLink() {
177 return [
178 // Empty name (T222529)
179 'Empty username, userid 0' => [ '(no username available)', 0, '' ],
180 'Empty username, userid > 0' => [ '(no username available)', 73, '' ],
181 ];
182 }
183
184 /**
185 * @dataProvider provideEmailLink
186 * @covers Linker::emailLink
187 * @param string $expected
188 * @param int $userId
189 * @param string $userText
190 */
191 public function testEmailLink( $expected, $userId, $userText ) {
192 // We'd also test the warning, but injecting a mock logger into a static method is tricky.
193 if ( $userText === '' ) {
194 Wikimedia\suppressWarnings();
195 }
196 $actual = Linker::emailLink( $userId, $userText );
197 if ( $userText === '' ) {
198 Wikimedia\restoreWarnings();
199 }
200
201 $this->assertSame( $expected, $actual );
202 }
203
204 public static function provideEmailLink() {
205 return [
206 // Empty name (T222529)
207 'Empty username, userid 0' => [ '(no username available)', 0, '' ],
208 'Empty username, userid > 0' => [ '(no username available)', 73, '' ],
209 ];
210 }
211
212 /**
213 * @dataProvider provideCasesForFormatComment
214 * @covers Linker::formatComment
215 * @covers Linker::formatAutocomments
216 * @covers Linker::formatLinksInComment
217 */
218 public function testFormatComment(
219 $expected, $comment, $title = false, $local = false, $wikiId = null
220 ) {
221 $conf = new SiteConfiguration();
222 $conf->settings = [
223 'wgServer' => [
224 'enwiki' => '//en.example.org',
225 'dewiki' => '//de.example.org',
226 ],
227 'wgArticlePath' => [
228 'enwiki' => '/w/$1',
229 'dewiki' => '/w/$1',
230 ],
231 ];
232 $conf->suffixes = [ 'wiki' ];
233
234 $this->setMwGlobals( [
235 'wgScript' => '/wiki/index.php',
236 'wgArticlePath' => '/wiki/$1',
237 'wgCapitalLinks' => true,
238 'wgConf' => $conf,
239 ] );
240
241 if ( $title === false ) {
242 // We need a page title that exists
243 $title = Title::newFromText( 'Special:BlankPage' );
244 }
245
246 $this->assertEquals(
247 $expected,
248 Linker::formatComment( $comment, $title, $local, $wikiId )
249 );
250 }
251
252 public function provideCasesForFormatComment() {
253 $wikiId = 'enwiki'; // $wgConf has a fake entry for this
254
255 // phpcs:disable Generic.Files.LineLength
256 return [
257 // Linker::formatComment
258 [
259 'a&lt;script&gt;b',
260 'a<script>b',
261 ],
262 [
263 'a—b',
264 'a&mdash;b',
265 ],
266 [
267 "&#039;&#039;&#039;not bolded&#039;&#039;&#039;",
268 "'''not bolded'''",
269 ],
270 [
271 "try &lt;script&gt;evil&lt;/scipt&gt; things",
272 "try <script>evil</scipt> things",
273 ],
274 // Linker::formatAutocomments
275 [
276 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→‎autocomment</a></span></span>',
277 "/* autocomment */",
278 ],
279 [
280 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#linkie.3F" title="Special:BlankPage">→‎&#91;[linkie?]]</a></span></span>',
281 "/* [[linkie?]] */",
282 ],
283 [
284 '<span dir="auto"><span class="autocomment">: </span> // Edit via via</span>',
285 // Regression test for T222857
286 "/* */ // Edit via via",
287 ],
288 [
289 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→‎autocomment</a>: </span> post</span>',
290 "/* autocomment */ post",
291 ],
292 [
293 'pre <span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→‎autocomment</a></span></span>',
294 "pre /* autocomment */",
295 ],
296 [
297 'pre <span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→‎autocomment</a>: </span> post</span>',
298 "pre /* autocomment */ post",
299 ],
300 [
301 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→‎autocomment</a>: </span> multiple? <span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment2" title="Special:BlankPage">→‎autocomment2</a></span></span></span>',
302 "/* autocomment */ multiple? /* autocomment2 */",
303 ],
304 [
305 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment_containing_.2F.2A" title="Special:BlankPage">→‎autocomment containing /*</a>: </span> T70361</span>',
306 "/* autocomment containing /* */ T70361"
307 ],
308 [
309 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment_containing_.22quotes.22" title="Special:BlankPage">→‎autocomment containing &quot;quotes&quot;</a></span></span>',
310 "/* autocomment containing \"quotes\" */"
311 ],
312 [
313 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment_containing_.3Cscript.3Etags.3C.2Fscript.3E" title="Special:BlankPage">→‎autocomment containing &lt;script&gt;tags&lt;/script&gt;</a></span></span>',
314 "/* autocomment containing <script>tags</script> */"
315 ],
316 [
317 '<span dir="auto"><span class="autocomment"><a href="#autocomment">→‎autocomment</a></span></span>',
318 "/* autocomment */",
319 false, true
320 ],
321 [
322 '<span dir="auto"><span class="autocomment">autocomment</span></span>',
323 "/* autocomment */",
324 null
325 ],
326 [
327 '',
328 "/* */",
329 false, true
330 ],
331 [
332 '',
333 "/* */",
334 null
335 ],
336 [
337 '<span dir="auto"><span class="autocomment">[[</span></span>',
338 "/* [[ */",
339 false, true
340 ],
341 [
342 '<span dir="auto"><span class="autocomment">[[</span></span>',
343 "/* [[ */",
344 null
345 ],
346 [
347 "foo <span dir=\"auto\"><span class=\"autocomment\"><a href=\"#.23\">→‎&#91;[#_\t_]]</a></span></span>",
348 "foo /* [[#_\t_]] */",
349 false, true
350 ],
351 [
352 "foo <span dir=\"auto\"><span class=\"autocomment\"><a href=\"#_.09\">#_\t_</a></span></span>",
353 "foo /* [[#_\t_]] */",
354 null
355 ],
356 [
357 '<span dir="auto"><span class="autocomment"><a href="/wiki/Special:BlankPage#autocomment" title="Special:BlankPage">→‎autocomment</a></span></span>',
358 "/* autocomment */",
359 false, false
360 ],
361 [
362 '<span dir="auto"><span class="autocomment"><a class="external" rel="nofollow" href="//en.example.org/w/Special:BlankPage#autocomment">→‎autocomment</a></span></span>',
363 "/* autocomment */",
364 false, false, $wikiId
365 ],
366 // Linker::formatLinksInComment
367 [
368 'abc <a href="/wiki/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">link</a> def',
369 "abc [[link]] def",
370 ],
371 [
372 'abc <a href="/wiki/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">text</a> def',
373 "abc [[link|text]] def",
374 ],
375 [
376 'abc <a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a> def',
377 "abc [[Special:BlankPage|]] def",
378 ],
379 [
380 'abc <a href="/wiki/index.php?title=%C4%84%C5%9B%C5%BC&amp;action=edit&amp;redlink=1" class="new" title="Ąśż (page does not exist)">ąśż</a> def',
381 "abc [[%C4%85%C5%9B%C5%BC]] def",
382 ],
383 [
384 'abc <a href="/wiki/Special:BlankPage#section" title="Special:BlankPage">#section</a> def',
385 "abc [[#section]] def",
386 ],
387 [
388 'abc <a href="/wiki/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> def',
389 "abc [[/subpage]] def",
390 ],
391 [
392 'abc <a href="/wiki/index.php?title=%22evil!%22&amp;action=edit&amp;redlink=1" class="new" title="&quot;evil!&quot; (page does not exist)">&quot;evil!&quot;</a> def',
393 "abc [[\"evil!\"]] def",
394 ],
395 [
396 'abc [[&lt;script&gt;very evil&lt;/script&gt;]] def',
397 "abc [[<script>very evil</script>]] def",
398 ],
399 [
400 'abc [[|]] def',
401 "abc [[|]] def",
402 ],
403 [
404 'abc <a href="/wiki/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">link</a> def',
405 "abc [[link]] def",
406 false, false
407 ],
408 [
409 'abc <a class="external" rel="nofollow" href="//en.example.org/w/Link">link</a> def',
410 "abc [[link]] def",
411 false, false, $wikiId
412 ],
413 ];
414 // phpcs:enable
415 }
416
417 /**
418 * @covers Linker::formatLinksInComment
419 * @dataProvider provideCasesForFormatLinksInComment
420 */
421 public function testFormatLinksInComment( $expected, $input, $wiki ) {
422 $conf = new SiteConfiguration();
423 $conf->settings = [
424 'wgServer' => [
425 'enwiki' => '//en.example.org'
426 ],
427 'wgArticlePath' => [
428 'enwiki' => '/w/$1',
429 ],
430 ];
431 $conf->suffixes = [ 'wiki' ];
432 $this->setMwGlobals( [
433 'wgScript' => '/wiki/index.php',
434 'wgArticlePath' => '/wiki/$1',
435 'wgCapitalLinks' => true,
436 'wgConf' => $conf,
437 ] );
438
439 $this->assertEquals(
440 $expected,
441 Linker::formatLinksInComment( $input, Title::newFromText( 'Special:BlankPage' ), false, $wiki )
442 );
443 }
444
445 /**
446 * @covers Linker::generateRollback
447 * @dataProvider provideCasesForRollbackGeneration
448 */
449 public function testGenerateRollback( $rollbackEnabled, $expectedModules, $title ) {
450 $this->markTestSkippedIfDbType( 'postgres' );
451
452 $context = RequestContext::getMain();
453 $user = $context->getUser();
454 $user->setOption( 'showrollbackconfirmation', $rollbackEnabled );
455
456 $this->assertEquals( 0, Title::newFromText( $title )->getArticleID() );
457 $pageData = $this->insertPage( $title );
458 $page = WikiPage::factory( $pageData['title'] );
459
460 $updater = $page->newPageUpdater( $user );
461 $updater->setContent( \MediaWiki\Revision\SlotRecord::MAIN,
462 new TextContent( 'Technical Wishes 123!' )
463 );
464 $summary = CommentStoreComment::newUnsavedComment( 'Some comment!' );
465 $updater->saveRevision( $summary );
466
467 $rollbackOutput = Linker::generateRollback( $page->getRevision(), $context );
468 $modules = $context->getOutput()->getModules();
469 $currentRev = $page->getRevision();
470 $oldestRev = $page->getOldestRevision();
471
472 $this->assertEquals( $expectedModules, $modules );
473 $this->assertEquals( $user->getName(), $currentRev->getUserText() );
474 $this->assertEquals(
475 static::getTestSysop()->getUser(),
476 $oldestRev->getUserText()
477 );
478
479 $ids = [];
480 $r = $oldestRev;
481 while ( $r ) {
482 $ids[] = $r->getId();
483 $r = $r->getNext();
484 }
485 $this->assertEquals( [ $oldestRev->getId(), $currentRev->getId() ], $ids );
486
487 $this->assertContains( 'rollback 1 edit', $rollbackOutput );
488 }
489
490 public static function provideCasesForRollbackGeneration() {
491 return [
492 [
493 true,
494 [ 'mediawiki.page.rollback.confirmation' ],
495 'Rollback_Test_Page'
496 ],
497 [
498 false,
499 [],
500 'Rollback_Test_Page2'
501 ]
502 ];
503 }
504
505 public static function provideCasesForFormatLinksInComment() {
506 // phpcs:disable Generic.Files.LineLength
507 return [
508 [
509 'foo bar <a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a>',
510 'foo bar [[Special:BlankPage]]',
511 null,
512 ],
513 [
514 '<a href="/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a>',
515 '[[ :Special:BlankPage]]',
516 null,
517 ],
518 [
519 '<a class="external" rel="nofollow" href="//en.example.org/w/Foo%27bar">Foo\'bar</a>',
520 "[[Foo'bar]]",
521 'enwiki',
522 ],
523 [
524 'foo bar <a class="external" rel="nofollow" href="//en.example.org/w/Special:BlankPage">Special:BlankPage</a>',
525 'foo bar [[Special:BlankPage]]',
526 'enwiki',
527 ],
528 [
529 'foo bar <a class="external" rel="nofollow" href="//en.example.org/w/File:Example">Image:Example</a>',
530 'foo bar [[Image:Example]]',
531 'enwiki',
532 ],
533 ];
534 // phpcs:enable
535 }
536
537 public static function provideLinkBeginHook() {
538 // phpcs:disable Generic.Files.LineLength
539 return [
540 // Modify $html
541 [
542 function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) {
543 $html = 'foobar';
544 },
545 '<a href="/wiki/Special:BlankPage" title="Special:BlankPage">foobar</a>'
546 ],
547 // Modify $attribs
548 [
549 function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) {
550 $attribs['bar'] = 'baz';
551 },
552 '<a href="/wiki/Special:BlankPage" title="Special:BlankPage" bar="baz">Special:BlankPage</a>'
553 ],
554 // Modify $query
555 [
556 function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) {
557 $query['bar'] = 'baz';
558 },
559 '<a href="/w/index.php?title=Special:BlankPage&amp;bar=baz" title="Special:BlankPage">Special:BlankPage</a>'
560 ],
561 // Force HTTP $options
562 [
563 function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) {
564 $options = [ 'http' ];
565 },
566 '<a href="http://example.org/wiki/Special:BlankPage" title="Special:BlankPage">Special:BlankPage</a>'
567 ],
568 // Force 'forcearticlepath' in $options
569 [
570 function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) {
571 $options = [ 'forcearticlepath' ];
572 $query['foo'] = 'bar';
573 },
574 '<a href="/wiki/Special:BlankPage?foo=bar" title="Special:BlankPage">Special:BlankPage</a>'
575 ],
576 // Abort early
577 [
578 function ( $dummy, $title, &$html, &$attribs, &$query, &$options, &$ret ) {
579 $ret = 'foobar';
580 return false;
581 },
582 'foobar'
583 ],
584 ];
585 // phpcs:enable
586 }
587
588 /**
589 * @covers MediaWiki\Linker\LinkRenderer::runLegacyBeginHook
590 * @dataProvider provideLinkBeginHook
591 */
592 public function testLinkBeginHook( $callback, $expected ) {
593 $this->hideDeprecated( 'LinkBegin hook (used in hook-LinkBegin-closure)' );
594 $this->setMwGlobals( [
595 'wgArticlePath' => '/wiki/$1',
596 'wgServer' => '//example.org',
597 'wgCanonicalServer' => 'http://example.org',
598 'wgScriptPath' => '/w',
599 'wgScript' => '/w/index.php',
600 ] );
601
602 $this->setMwGlobals( 'wgHooks', [ 'LinkBegin' => [ $callback ] ] );
603 $title = SpecialPage::getTitleFor( 'Blankpage' );
604 $out = Linker::link( $title );
605 $this->assertEquals( $expected, $out );
606 }
607
608 public static function provideLinkEndHook() {
609 return [
610 // Override $html
611 [
612 function ( $dummy, $title, $options, &$html, &$attribs, &$ret ) {
613 $html = 'foobar';
614 },
615 '<a href="/wiki/Special:BlankPage" title="Special:BlankPage">foobar</a>'
616 ],
617 // Modify $attribs
618 [
619 function ( $dummy, $title, $options, &$html, &$attribs, &$ret ) {
620 $attribs['bar'] = 'baz';
621 },
622 '<a href="/wiki/Special:BlankPage" title="Special:BlankPage" bar="baz">Special:BlankPage</a>'
623 ],
624 // Fully override return value and abort hook
625 [
626 function ( $dummy, $title, $options, &$html, &$attribs, &$ret ) {
627 $ret = 'blahblahblah';
628 return false;
629 },
630 'blahblahblah'
631 ],
632
633 ];
634 }
635
636 /**
637 * @covers MediaWiki\Linker\LinkRenderer::buildAElement
638 * @dataProvider provideLinkEndHook
639 */
640 public function testLinkEndHook( $callback, $expected ) {
641 $this->hideDeprecated( 'LinkEnd hook (used in hook-LinkEnd-closure)' );
642 $this->setMwGlobals( [
643 'wgArticlePath' => '/wiki/$1',
644 ] );
645
646 $this->setMwGlobals( 'wgHooks', [ 'LinkEnd' => [ $callback ] ] );
647
648 $title = SpecialPage::getTitleFor( 'Blankpage' );
649 $out = Linker::link( $title );
650 $this->assertEquals( $expected, $out );
651 }
652 }