X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpreprocessorFuzzTest.php;h=8df01e66fb597ff89c6e2b3f37d1838ec91b2899;hb=e900893531e76fb8f80c1c9b5be459fd02862c3c;hp=d5d27ad8ce9605aaaef2f05dc63baf2f736d2c68;hpb=8d91ac5f12f6883b34f64991fd277954fe8ed37e;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index d5d27ad8ce..bdc955bb86 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -23,6 +23,8 @@ use MediaWiki\MediaWikiServices; +use Wikimedia\TestingAccessWrapper; + $optionsWithoutArgs = [ 'verbose' ]; require_once __DIR__ . '/commandLine.inc'; @@ -46,7 +48,7 @@ class PPFuzzTester { 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; /** @@ -72,7 +74,7 @@ class PPFuzzTester { $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", @@ -150,6 +152,16 @@ class PPFuzzTester { 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; @@ -195,7 +207,7 @@ class PPFuzzTest { } function execute() { - global $wgParser, $wgUser; + global $wgUser; $wgUser = new PPFuzzUser; $wgUser->mName = 'Fuzz'; @@ -206,7 +218,9 @@ class PPFuzzTest { $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 @@ -239,7 +253,7 @@ class PPFuzzTest { class PPFuzzUser extends User { public $ppfz_test, $mDataLoaded; - function load() { + function load( $flags = null ) { if ( $this->mDataLoaded ) { return; }