From ee5078708aabc4688ed94f1e2b9f620b4f3962ab Mon Sep 17 00:00:00 2001
From: Kunal Mehta
Date: Tue, 31 May 2016 22:20:36 -0700
Subject: [PATCH] Add a parser test for $wgNoFollowDomainExceptions
functionality
Verify that domains on the exception list don't get a "nofollow"
attribute.
Change-Id: I01a7fc0fd9ccd21069beb26dcf3f775c79e00202
---
tests/parser/parserTest.inc | 2 +-
tests/parser/parserTests.txt | 9 +++++++++
tests/phpunit/includes/parser/NewParserTest.php | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc
index c2bb78d82c..132743f32d 100644
--- a/tests/parser/parserTest.inc
+++ b/tests/parser/parserTest.inc
@@ -891,7 +891,7 @@ class ParserTest {
'wgMaxTocLevel' => $maxtoclevel,
'wgCapitalLinks' => true,
'wgNoFollowLinks' => true,
- 'wgNoFollowDomainExceptions' => [],
+ 'wgNoFollowDomainExceptions' => [ 'no-nofollow.org' ],
'wgThumbnailScriptPath' => false,
'wgUseImageResize' => true,
'wgSVGConverter' => 'null',
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 523953c1d4..2f5450c91c 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -4782,6 +4782,15 @@ ok-http://exam
!! end
+!! test
+External links: nofollow domain exception
+!! wikitext
+A [https://no-nofollow.org/foobar link], and another [https://example.org link].
+!! html
+A link, and another link.
+
+!!end
+
!! test
External image
!! wikitext
diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php
index c024555a2c..354ddd4fc6 100644
--- a/tests/phpunit/includes/parser/NewParserTest.php
+++ b/tests/phpunit/includes/parser/NewParserTest.php
@@ -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;
--
2.20.1