From 0d8d2bfbb2cf7ff5794d5e77ce9963f5820932a0 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Tue, 29 Aug 2017 05:56:17 +0200 Subject: [PATCH] Test black list. --- tests/phpunit/LinkerTest.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/LinkerTest.php b/tests/phpunit/LinkerTest.php index 108e669..b221910 100644 --- a/tests/phpunit/LinkerTest.php +++ b/tests/phpunit/LinkerTest.php @@ -22,7 +22,7 @@ class LinkTitlesLinkerTest extends LinkTitles\TestCase { /** * @dataProvider provideLinkContentSmartModeData */ - public function testLinkContentSmartMode( $capitalLinks, $smartMode, $input, $expectedOutput) { + public function testLinkContentSmartMode( $capitalLinks, $smartMode, $input, $expectedOutput ) { $this->setMwGlobals( 'wgCapitalLinks', $capitalLinks ); $config = new LinkTitles\Config(); $config->firstOnly = false; @@ -130,4 +130,12 @@ class LinkTitlesLinkerTest extends LinkTitles\TestCase { ], ]; } + + public function testLinkContentBlackList() { + $config = new LinkTitles\Config(); + $config->blackList = [ 'Foo', 'Link target', 'Bar' ]; + $linker = new LinkTitles\Linker( $config ); + $text = 'If the link target is blacklisted, it should not be linked'; + $this->assertSame( $text, $linker->linkContent( $this->title, $text ) ); + } }