From ec1a07889cb379dae0720a0c33eacddbd45c8e37 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Wed, 17 Aug 2011 22:09:57 +0000 Subject: [PATCH] Make the testCleanSig work no matter what $wgCleanSignatures; is in LocalSettings.php . Also have a test for when sig cleaning is disabled. --- tests/phpunit/includes/ExtraParserTest.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index d10465fde8..1fdee947d1 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -63,11 +63,33 @@ class ExtraParserTest extends MediaWikiTestCase { * cleanSig() makes all templates substs and removes tildes */ function testCleanSig() { + global $wgCleanSignatures; + $oldCleanSignature = $wgCleanSignatures; + $wgCleanSignatures = true; + $title = Title::newFromText( __FUNCTION__ ); $outputText = $this->parser->cleanSig( "{{Foo}} ~~~~" ); + + $wgCleanSignatures = $oldCleanSignature; $this->assertEquals( "{{SUBST:Foo}} ", $outputText ); } + + /** + * cleanSig() should do nothing if disabled + */ + function testCleanSigDisabled() { + global $wgCleanSignatures; + $oldCleanSignature = $wgCleanSignatures; + $wgCleanSignatures = false; + + $title = Title::newFromText( __FUNCTION__ ); + $outputText = $this->parser->cleanSig( "{{Foo}} ~~~~" ); + + $wgCleanSignatures = $oldCleanSignature; + + $this->assertEquals( "{{Foo}} ~~~~", $outputText ); + } /** * cleanSigInSig() just removes tildes -- 2.20.1