X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpreprocessorFuzzTest.php;h=4f478ac9724eb1f7ce1040099c582e748e5e9958;hb=6e9b4f0e9ce4ccd6089c18b205065ef7fa077484;hp=cb55f0f26320b137415d13f041047d7aa686435b;hpb=a04d94d4f22f8fa1be0a0e9a8b0bda5a9e003b28;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index cb55f0f263..4f478ac972 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -26,7 +26,7 @@ require_once __DIR__ . '/commandLine.inc'; $wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'PPFuzzTester::templateHook'; class PPFuzzTester { - public $hairs = array( + public $hairs = [ '[[', ']]', '{{', '{{', '}}', '}}', '{{{', '}}}', '<', '>', '', '', '', '', '', @@ -38,12 +38,12 @@ 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 $entryPoints = [ 'testSrvus', 'testPst', 'testPreprocess' ]; public $verbose = false; private static $currentTest = false; @@ -64,7 +64,7 @@ class PPFuzzTester { self::$currentTest = new PPFuzzTest( $this ); self::$currentTest->execute(); $passed = 'passed'; - } catch ( MWException $e ) { + } catch ( Exception $e ) { $testReport = self::$currentTest->getReport(); $exceptionReport = $e->getText(); $hash = md5( $testReport ); @@ -154,7 +154,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 +181,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 +198,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 @@ -212,7 +212,7 @@ class PPFuzzTest { function getReport() { $s = "Title: " . $this->title->getPrefixedDBkey() . "\n" . -// "Output type: {$this->outputType}\n" . +// "Output type: {$this->outputType}\n" . "Entry point: {$this->entryPoint}\n" . "User: " . ( $this->fancySig ? 'fancy' : 'no-fancy' ) . ' ' . var_export( $this->nickname, true ) . "\n" .