* @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(
'[[', ']]', '{{', '{{', '}}', '}}', '{{{', '}}}',
'<', '>', '<nowiki', '<gallery', '</nowiki>', '</gallery>', '<nOwIkI>', '</NoWiKi>',
'<!--' , '-->',
// extensions
// '<ref>', '</ref>', '<references/>',
);
- 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() {
file_put_contents( $filename, "Input:\n$testReport\n" );*/
}
}
- wfLogProfilingData();
}
function makeInputText( $max = false ) {
}
class PPFuzzTest {
- var $templates, $mainText, $title, $entryPoint, $output;
+ public $templates, $mainText, $title, $entryPoint, $output;
function __construct( $tester ) {
global $wgMaxSigChars;
$this->templates = array();
}
+ /**
+ * @param $title Title
+ */
function templateHook( $title ) {
$titleText = $title->getPrefixedDBkey();
$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;
}
}
class PPFuzzUser extends User {
- var $ppfz_test;
+ public $ppfz_test, $mDataLoaded;
function load() {
if ( $this->mDataLoaded ) {
$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 );
}
}
}