X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fparser%2FParserTestRunner.php;h=60a58811d3622a1ab39aef1a92cdf39afb4d559e;hb=138298b397b308ad6e4bfc7088884d90e8ac1e37;hp=08ec9f6d8de8c7d3d40af2b53890afea62a9fff6;hpb=478a58f63101f2b47d18a618296b5e7970fa3f24;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/parser/ParserTestRunner.php b/tests/parser/ParserTestRunner.php index 08ec9f6d8d..60a58811d3 100644 --- a/tests/parser/ParserTestRunner.php +++ b/tests/parser/ParserTestRunner.php @@ -143,8 +143,7 @@ class ParserTestRunner { $this->keepUploads = !empty( $options['keep-uploads'] ); - $this->fileBackendName = isset( $options['file-backend'] ) ? - $options['file-backend'] : false; + $this->fileBackendName = $options['file-backend'] ?? false; $this->runDisabled = !empty( $options['run-disabled'] ); $this->runParsoid = !empty( $options['run-parsoid'] ); @@ -465,7 +464,7 @@ class ParserTestRunner { if ( is_int( $name ) ) { $value(); } else { - $saved[$name] = isset( $GLOBALS[$name] ) ? $GLOBALS[$name] : null; + $saved[$name] = $GLOBALS[$name] ?? null; $GLOBALS[$name] = $value; } } @@ -537,7 +536,7 @@ class ParserTestRunner { * @return bool */ public function isSetupDone( $funcName ) { - return isset( $this->setupDone[$funcName] ) ? $this->setupDone[$funcName] : false; + return $this->setupDone[$funcName] ?? false; } /** @@ -829,8 +828,15 @@ class ParserTestRunner { $titleText = 'Parser test'; } + if ( isset( $opts['maxincludesize'] ) ) { + $options->setMaxIncludeSize( $opts['maxincludesize'] ); + } + if ( isset( $opts['maxtemplatedepth'] ) ) { + $options->setMaxTemplateDepth( $opts['maxtemplatedepth'] ); + } + $local = isset( $opts['local'] ); - $preprocessor = isset( $opts['preprocessor'] ) ? $opts['preprocessor'] : null; + $preprocessor = $opts['preprocessor'] ?? null; $parser = $this->getParser( $preprocessor ); $title = Title::newFromText( $titleText ); @@ -1083,6 +1089,11 @@ class ParserTestRunner { 'wgFragmentMode' => [ 'legacy' ], ]; + $nonIncludable = self::getOptionValue( 'wgNonincludableNamespaces', $opts, false ); + if ( $nonIncludable !== false ) { + $setup['wgNonincludableNamespaces'] = [ $nonIncludable ]; + } + if ( $config ) { $configLines = explode( "\n", $config ); @@ -1270,7 +1281,7 @@ class ParserTestRunner { // Wipe some DB query result caches on setup and teardown $reset = function () { - LinkCache::singleton()->clear(); + MediaWikiServices::getInstance()->getLinkCache()->clear(); // Clear the message cache MessageCache::singleton()->clear();