From 44574b23b09374c42143d8d82f6fb03e06c2d33f Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Wed, 22 Jun 2011 17:45:31 +0000 Subject: [PATCH] Removed hidden usage of $wgTitle in parser and the workarround in ExtraParserTest.php --- includes/parser/Parser.php | 8 +++----- tests/phpunit/includes/ExtraParserTest.php | 4 +--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 2640a986c5..d44c20c17e 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4383,11 +4383,9 @@ class Parser { # If we're still here, make it a link to the user page $userText = wfEscapeWikiText( $username ); $nickText = wfEscapeWikiText( $nickname ); - if ( $user->isAnon() ) { - return wfMsgExt( 'signature-anon', array( 'content', 'parsemag' ), $userText, $nickText ); - } else { - return wfMsgExt( 'signature', array( 'content', 'parsemag' ), $userText, $nickText ); - } + $msgName = $user->isAnon() ? 'signature-anon' : 'signature'; + + return wfMessage( $msgName, $userText, $nickText )->inContentLanguage()->title( $this->getTitle() )->text(); } /** diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index 54f2915d5c..5b0aa98ba8 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -43,13 +43,11 @@ class ExtraParserTest extends MediaWikiTestCase { } function testPreSaveTransform() { - global $wgUser, $wgTitle; + global $wgUser; $title = Title::newFromText( __FUNCTION__ ); - $oldTitle = $wgTitle; $wgTitle = $title; # Used by transformMsg() $outputText = $this->parser->preSaveTransform( "Test\r\n{{subst:Foo}}\n{{Bar}}", $title, $wgUser, $this->options ); $this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText ); - $wgTitle = $oldTitle; } function testPreprocess() { -- 2.20.1