* make preprocessorFuzzTest.php pass the Title object to Parser, removed checks for...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 30 May 2011 16:10:23 +0000 (16:10 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Mon, 30 May 2011 16:10:23 +0000 (16:10 +0000)
* make the parser use ParserOptions::getUser() instead of $wgUser
* fixed some E_NOTICE and E_STRICT in preprocessorFuzzTest.php

includes/parser/Parser.php
maintenance/preprocessorFuzzTest.php

index 74480b6..010da1f 100644 (file)
@@ -5461,9 +5461,6 @@ class Parser {
         * @return string
         */
        function testSrvus( $text, $title, ParserOptions $options, $outputType = self::OT_HTML ) {
-               if ( !$title instanceof Title ) {
-                       $title = Title::newFromText( $title );
-               }
                $this->startParse( $title, $options, $outputType, true );
 
                $text = $this->replaceVariables( $text );
@@ -5473,17 +5470,10 @@ class Parser {
        }
 
        function testPst( $text, $title, $options ) {
-               global $wgUser;
-               if ( !$title instanceof Title ) {
-                       $title = Title::newFromText( $title );
-               }
-               return $this->preSaveTransform( $text, $title, $wgUser, $options );
+               return $this->preSaveTransform( $text, $title, $options->getUser(), $options );
        }
 
        function testPreprocess( $text, $title, $options ) {
-               if ( !$title instanceof Title ) {
-                       $title = Title::newFromText( $title );
-               }
                return $this->testSrvus( $text, $title, $options, self::OT_PREPROCESS );
        }
 
index fbf3b93..20eb0c4 100644 (file)
@@ -190,10 +190,10 @@ class PPFuzzTest {
                $wgUser->mFrom = 'name';
                $wgUser->ppfz_test = $this;
 
-               $options = new ParserOptions;
+               $options = ParserOptions::newFromUser( $wgUser );
                $options->setTemplateCallback( array( $this, 'templateHook' ) );
                $options->setTimestamp( wfTimestampNow() );
-               $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title->getPrefixedText(), $options );
+               $this->output = call_user_func( array( $wgParser, $this->entryPoint ), $this->mainText, $this->title, $options );
                return $this->output;
        }
 
@@ -217,7 +217,7 @@ class PPFuzzTest {
 }
 
 class PPFuzzUser extends User {
-       var $ppfz_test;
+       var $ppfz_test, $mDataLoaded;
 
        function load() {
                if ( $this->mDataLoaded ) {
@@ -227,13 +227,13 @@ class PPFuzzUser extends User {
                $this->loadDefaults( $this->mName );
        }
 
-       function getOption( $option, $defaultOverride = '' ) {
+       function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) {
                if ( $option === 'fancysig' ) {
                        return $this->ppfz_test->fancySig;
                } elseif ( $option === 'nickname' ) {
                        return $this->ppfz_test->nickname;
                } else {
-                       return parent::getOption( $option, $defaultOverride );
+                       return parent::getOption( $option, $defaultOverride, $ignoreHidden );
                }
        }
 }