Make the parser tests' "subpage" option actually enable for all subpages
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 23 Feb 2017 21:14:54 +0000 (16:14 -0500)
committerTim Starling <tstarling@wikimedia.org>
Fri, 3 Mar 2017 05:32:36 +0000 (05:32 +0000)
The option says "enable subpages (disabled by default)", but it
currently just enables subpages for namespaces 0 and 2. This tripped me
up when writing some parser tests for TemplateStyles where I need
subpages enabled for namespace 10.

There's probably no reason not to have it enable subpages for all
namespaces.

Change-Id: Icf864dafc4208a76af7b3e71f5f9c97576c065b7

tests/parser/ParserTestRunner.php

index 7edde2a..35c2480 100644 (file)
@@ -974,10 +974,9 @@ class ParserTestRunner {
                        'wgEnableUploads' => self::getOptionValue( 'wgEnableUploads', $opts, true ),
                        'wgLanguageCode' => $langCode,
                        'wgRawHtml' => self::getOptionValue( 'wgRawHtml', $opts, false ),
-                       'wgNamespacesWithSubpages' => [
-                               0 => isset( $opts['subpage'] ),
-                               2 => isset( $opts['subpage'] ),
-                       ],
+                       'wgNamespacesWithSubpages' => array_fill_keys(
+                               MWNamespace::getValidNamespaces(), isset( $opts['subpage'] )
+                       ),
                        'wgMaxTocLevel' => $maxtoclevel,
                        'wgAllowExternalImages' => self::getOptionValue( 'wgAllowExternalImages', $opts, true ),
                        'wgThumbLimits' => [ self::getOptionValue( 'thumbsize', $opts, 180 ) ],