Merge "Fix 'Tags' padding to keep it farther from the edge and document the source...
[lhc/web/wiklou.git] / tests / parser / ParserTestRunner.php
index 08ec9f6..60a5881 100644 (file)
@@ -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();