preSaveTransform() needs $wgTitle.
authorPlatonides <platonides@users.mediawiki.org>
Sun, 23 Jan 2011 18:43:08 +0000 (18:43 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Sun, 23 Jan 2011 18:43:08 +0000 (18:43 +0000)
tests/phpunit/includes/ExtraParserTest.php

index 949262a..94087fa 100644 (file)
@@ -41,11 +41,13 @@ class ExtraParserTest extends MediaWikiTestCase {
        }
        
        function testPreSaveTransform() {
-               global $wgUser;
+               global $wgUser, $wgTitle;
                $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() {