Add a parser test for $wgNoFollowDomainExceptions functionality
authorKunal Mehta <legoktm@member.fsf.org>
Wed, 1 Jun 2016 05:20:36 +0000 (22:20 -0700)
committerKunal Mehta <legoktm@member.fsf.org>
Wed, 1 Jun 2016 05:20:36 +0000 (22:20 -0700)
Verify that domains on the exception list don't get a "nofollow"
attribute.

Change-Id: I01a7fc0fd9ccd21069beb26dcf3f775c79e00202

tests/parser/parserTest.inc
tests/parser/parserTests.txt
tests/phpunit/includes/parser/NewParserTest.php

index c2bb78d..132743f 100644 (file)
@@ -891,7 +891,7 @@ class ParserTest {
                        'wgMaxTocLevel' => $maxtoclevel,
                        'wgCapitalLinks' => true,
                        'wgNoFollowLinks' => true,
-                       'wgNoFollowDomainExceptions' => [],
+                       'wgNoFollowDomainExceptions' => [ 'no-nofollow.org' ],
                        'wgThumbnailScriptPath' => false,
                        'wgUseImageResize' => true,
                        'wgSVGConverter' => 'null',
index 523953c..2f5450c 100644 (file)
@@ -4782,6 +4782,15 @@ ok-<a rel="nofollow" class="external free" href="http://example.com">http://exam
 </p>
 !! end
 
+!! test
+External links: nofollow domain exception
+!! wikitext
+A [https://no-nofollow.org/foobar link], and another [https://example.org link].
+!! html
+<p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
+</p>
+!!end
+
 !! test
 External image
 !! wikitext
index c024555..354ddd4 100644 (file)
@@ -94,7 +94,7 @@ class NewParserTest extends MediaWikiTestCase {
                $tmpGlobals['wgParserCacheType'] = CACHE_NONE;
                $tmpGlobals['wgCapitalLinks'] = true;
                $tmpGlobals['wgNoFollowLinks'] = true;
-               $tmpGlobals['wgNoFollowDomainExceptions'] = [];
+               $tmpGlobals['wgNoFollowDomainExceptions'] = [ 'no-nofollow.org' ];
                $tmpGlobals['wgExternalLinkTarget'] = false;
                $tmpGlobals['wgThumbnailScriptPath'] = false;
                $tmpGlobals['wgUseImageResize'] = true;