X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpreprocessorFuzzTest.php;h=49c7aee3b97df9973a204c732826efe72e4dcae2;hb=5abe15bb9daa6197544087688d73ba11eb7fa801;hp=fbf3b93227596666355247ec86c5a65ee7c33d34;hpb=9f5d06527c649911ba4dcbe1c42df728d76faabe;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index fbf3b93227..49c7aee3b9 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -21,12 +21,12 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); $wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'PPFuzzTester::templateHook'; class PPFuzzTester { - var $hairs = array( + public $hairs = array( '[[', ']]', '{{', '{{', '}}', '}}', '{{{', '}}}', '<', '>', '', '', '', '', '', @@ -39,12 +39,12 @@ class PPFuzzTester { // extensions // '', '', '', ); - var $minLength = 0; - var $maxLength = 20; - var $maxTemplates = 5; - // var $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' ); - var $entryPoints = array( 'testSrvus', 'testPst', 'testPreprocess' ); - var $verbose = false; + public $minLength = 0; + public $maxLength = 20; + public $maxTemplates = 5; + // public $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' ); + public $entryPoints = array( 'testSrvus', 'testPst', 'testPreprocess' ); + public $verbose = false; static $currentTest = false; function execute() { @@ -102,7 +102,6 @@ class PPFuzzTester { file_put_contents( $filename, "Input:\n$testReport\n" );*/ } } - wfLogProfilingData(); } function makeInputText( $max = false ) { @@ -141,7 +140,7 @@ class PPFuzzTester { } class PPFuzzTest { - var $templates, $mainText, $title, $entryPoint, $output; + public $templates, $mainText, $title, $entryPoint, $output; function __construct( $tester ) { global $wgMaxSigChars; @@ -155,6 +154,9 @@ class PPFuzzTest { $this->templates = array(); } + /** + * @param $title Title + */ function templateHook( $title ) { $titleText = $title->getPrefixedDBkey(); @@ -190,10 +192,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 +219,7 @@ class PPFuzzTest { } class PPFuzzUser extends User { - var $ppfz_test; + public $ppfz_test, $mDataLoaded; function load() { if ( $this->mDataLoaded ) { @@ -227,13 +229,13 @@ class PPFuzzUser extends User { $this->loadDefaults( $this->mName ); } - function getOption( $option, $defaultOverride = '' ) { - if ( $option === 'fancysig' ) { + function getOption( $oname, $defaultOverride = null, $ignoreHidden = false ) { + if ( $oname === 'fancysig' ) { return $this->ppfz_test->fancySig; - } elseif ( $option === 'nickname' ) { + } elseif ( $oname === 'nickname' ) { return $this->ppfz_test->nickname; } else { - return parent::getOption( $option, $defaultOverride ); + return parent::getOption( $oname, $defaultOverride, $ignoreHidden ); } } }