set wgLanguageCode in NewParserTests for all tests
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 18 Feb 2013 17:58:35 +0000 (18:58 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 19 Feb 2013 21:18:03 +0000 (21:18 +0000)
Change one method default and use a constant

Change-Id: Id8d6817c616c289834c6af9ecbc183dbc76fbded

tests/phpunit/includes/parser/NewParserTest.php

index 5c7597e..ec9ee1a 100644 (file)
@@ -32,15 +32,11 @@ class NewParserTest extends MediaWikiTestCase {
        protected $file = false;
 
        protected function setUp() {
-               global $wgContLang, $wgLanguageCode;
                global $wgNamespaceProtection, $wgNamespaceAliases;
                global $wgHooks, $IP;
 
                parent::setUp();
 
-               $wgLanguageCode = 'en';
-               $wgContLang = Language::factory( 'en' );
-
                //Setup CLI arguments
                if ( $this->getCliArg( 'regex=' ) ) {
                        $this->regex = $this->getCliArg( 'regex=' );
@@ -53,6 +49,8 @@ class NewParserTest extends MediaWikiTestCase {
 
                $tmpGlobals = array();
 
+               $tmpGlobals['wgLanguageCode'] = 'en';
+               $tmpGlobals['wgContLang'] = Language::factory( 'en' );
                $tmpGlobals['wgScript'] = '/index.php';
                $tmpGlobals['wgScriptPath'] = '/';
                $tmpGlobals['wgArticlePath'] = '/wiki/$1';
@@ -236,7 +234,7 @@ class NewParserTest extends MediaWikiTestCase {
         * Set up the global variables for a consistent environment for each test.
         * Ideally this should replace the global configuration entirely.
         */
-       protected function setupGlobals( $opts = '', $config = '' ) {
+       protected function setupGlobals( $opts = array(), $config = '' ) {
                global $wgFileBackends;
                # Find out values for some special options.
                $lang =
@@ -300,7 +298,7 @@ class NewParserTest extends MediaWikiTestCase {
                        'wgRawHtml' => isset( $opts['rawhtml'] ),
                        'wgLang' => null,
                        'wgContLang' => null,
-                       'wgNamespacesWithSubpages' => array( 0 => isset( $opts['subpage'] ) ),
+                       'wgNamespacesWithSubpages' => array( NS_MAIN => isset( $opts['subpage'] ) ),
                        'wgMaxTocLevel' => $maxtoclevel,
                        'wgCapitalLinks' => true,
                        'wgNoFollowLinks' => true,