X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=maintenance%2FpreprocessorFuzzTest.php;h=aa5d69d95d9498a4357f906b704b3b5531ff87ad;hb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;hp=4d38710e1fb4cf74ef5aad85b858bc612d188cac;hpb=4a883e2ec8dec91254b3232af298014121642d19;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index 4d38710e1f..2503ed25e2 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -21,12 +21,13 @@ * @ingroup Maintenance */ +$optionsWithoutArgs = [ 'verbose' ]; require_once __DIR__ . '/commandLine.inc'; $wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'PPFuzzTester::templateHook'; class PPFuzzTester { - public $hairs = array( + public $hairs = [ '[[', ']]', '{{', '{{', '}}', '}}', '{{{', '}}}', '<', '>', '', '', '', '', '', @@ -38,14 +39,17 @@ class PPFuzzTester { // extensions // '', '', '', - ); + ]; 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 $outputTypes = [ 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' ]; + public $entryPoints = [ 'testSrvus', 'testPst', 'testPreprocess' ]; public $verbose = false; + /** + * @var bool|PPFuzzTest + */ private static $currentTest = false; function execute() { @@ -154,7 +158,7 @@ class PPFuzzTest { $this->entryPoint = $tester->pickEntryPoint(); $this->nickname = $tester->makeInputText( $wgMaxSigChars + 10 ); $this->fancySig = (bool)mt_rand( 0, 1 ); - $this->templates = array(); + $this->templates = []; } /** @@ -181,9 +185,9 @@ class PPFuzzTest { $text = $this->parent->makeInputText(); } } - $this->templates[$titleText] = array( + $this->templates[$titleText] = [ 'text' => $text, - 'finalTitle' => $finalTitle ); + 'finalTitle' => $finalTitle ]; } return $this->templates[$titleText]; @@ -198,10 +202,10 @@ class PPFuzzTest { $wgUser->ppfz_test = $this; $options = ParserOptions::newFromUser( $wgUser ); - $options->setTemplateCallback( array( $this, 'templateHook' ) ); + $options->setTemplateCallback( [ $this, 'templateHook' ] ); $options->setTimestamp( wfTimestampNow() ); $this->output = call_user_func( - array( $wgParser, $this->entryPoint ), + [ $wgParser, $this->entryPoint ], $this->mainText, $this->title, $options