use MediaWiki\MediaWikiServices;
+use Wikimedia\TestingAccessWrapper;
+
$optionsWithoutArgs = [ 'verbose' ];
require_once __DIR__ . '/commandLine.inc';
public $maxLength = 20;
public $maxTemplates = 5;
// public $outputTypes = [ 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' ];
- public $entryPoints = [ 'testSrvus', 'testPst', 'testPreprocess' ];
+ public $entryPoints = [ 'fuzzTestSrvus', 'fuzzTestPst', 'fuzzTestPreprocess' ];
public $verbose = false;
/**
$passed = 'passed';
} catch ( Exception $e ) {
$testReport = self::$currentTest->getReport();
- $exceptionReport = $e->getText();
+ $exceptionReport = $e instanceof MWException ? $e->getText() : (string)$e;
$hash = md5( $testReport );
file_put_contents( "results/ppft-$hash.in", serialize( self::$currentTest ) );
file_put_contents( "results/ppft-$hash.fail",
class PPFuzzTest {
public $templates, $mainText, $title, $entryPoint, $output;
+ /** @var PPFuzzTester */
+ private $parent;
+ /** @var string */
+ public $nickname;
+ /** @var bool */
+ public $fancySig;
+
+ /**
+ * @param PPFuzzTester $tester
+ */
function __construct( $tester ) {
global $wgMaxSigChars;
$this->parent = $tester;
}
function execute() {
- global $wgParser, $wgUser;
+ global $wgUser;
$wgUser = new PPFuzzUser;
$wgUser->mName = 'Fuzz';
$options->setTemplateCallback( [ $this, 'templateHook' ] );
$options->setTimestamp( wfTimestampNow() );
$this->output = call_user_func(
- [ $wgParser, $this->entryPoint ],
+ [ TestingAccessWrapper::newFromObject(
+ MediaWikiServices::getInstance()->getParser()
+ ), $this->entryPoint ],
$this->mainText,
$this->title,
$options
class PPFuzzUser extends User {
public $ppfz_test, $mDataLoaded;
- function load() {
+ function load( $flags = null ) {
if ( $this->mDataLoaded ) {
return;
}