summaryrefslogtreecommitdiff
path: root/maintenance/preprocessorFuzzTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 13:29:22 +0100
commitca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch)
treeec04cc15b867bc21eedca904cea9af0254531a11 /maintenance/preprocessorFuzzTest.php
parenta22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff)
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing
Diffstat (limited to 'maintenance/preprocessorFuzzTest.php')
-rw-r--r--maintenance/preprocessorFuzzTest.php35
1 files changed, 27 insertions, 8 deletions
diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php
index 31b372c2..9dee67e2 100644
--- a/maintenance/preprocessorFuzzTest.php
+++ b/maintenance/preprocessorFuzzTest.php
@@ -1,5 +1,22 @@
<?php
/**
+ * Performs fuzz-style testing of MediaWiki's preprocessor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup Maintenance
*/
@@ -85,7 +102,6 @@ class PPFuzzTester {
file_put_contents( $filename, "Input:\n$testReport\n" );*/
}
}
- wfLogProfilingData();
}
function makeInputText( $max = false ) {
@@ -138,6 +154,9 @@ class PPFuzzTest {
$this->templates = array();
}
+ /**
+ * @param $title Title
+ */
function templateHook( $title ) {
$titleText = $title->getPrefixedDBkey();
@@ -173,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;
}
@@ -200,7 +219,7 @@ class PPFuzzTest {
}
class PPFuzzUser extends User {
- var $ppfz_test;
+ var $ppfz_test, $mDataLoaded;
function load() {
if ( $this->mDataLoaded ) {
@@ -210,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 );
}
}
}