RevisionStorageTest: use MediaWikiTestCase methods for setting globals
authoraddshore <addshorewiki@gmail.com>
Wed, 11 Oct 2017 14:02:38 +0000 (15:02 +0100)
committerLegoktm <legoktm@member.fsf.org>
Thu, 12 Oct 2017 07:02:09 +0000 (07:02 +0000)
Change-Id: I8712517b50c5b552fe2d0e248b5735945a98fba4

tests/phpunit/includes/RevisionStorageTest.php

index d098700..a15b9b4 100644 (file)
@@ -39,15 +39,31 @@ class RevisionStorageTest extends MediaWikiTestCase {
        }
 
        protected function setUp() {
        }
 
        protected function setUp() {
-               global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
+               global $wgContLang;
 
                parent::setUp();
 
 
                parent::setUp();
 
-               $wgExtraNamespaces[12312] = 'Dummy';
-               $wgExtraNamespaces[12313] = 'Dummy_talk';
+               $this->mergeMwGlobalArrayValue(
+                       'wgExtraNamespaces',
+                       [
+                               12312 => 'Dummy',
+                               12313 => 'Dummy_talk',
+                       ]
+               );
+
+               $this->mergeMwGlobalArrayValue(
+                       'wgNamespaceContentModels',
+                       [
+                               12312 => 'DUMMY',
+                       ]
+               );
 
 
-               $wgNamespaceContentModels[12312] = 'DUMMY';
-               $wgContentHandlers['DUMMY'] = 'DummyContentHandlerForTesting';
+               $this->mergeMwGlobalArrayValue(
+                       'wgContentHandlers',
+                       [
+                               'DUMMY' => 'DummyContentHandlerForTesting',
+                       ]
+               );
 
                MWNamespace::clearCaches();
                // Reset namespace cache
 
                MWNamespace::clearCaches();
                // Reset namespace cache
@@ -64,16 +80,10 @@ class RevisionStorageTest extends MediaWikiTestCase {
        }
 
        protected function tearDown() {
        }
 
        protected function tearDown() {
-               global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
+               global $wgContLang;
 
                parent::tearDown();
 
 
                parent::tearDown();
 
-               unset( $wgExtraNamespaces[12312] );
-               unset( $wgExtraNamespaces[12313] );
-
-               unset( $wgNamespaceContentModels[12312] );
-               unset( $wgContentHandlers['DUMMY'] );
-
                MWNamespace::clearCaches();
                // Reset namespace cache
                $wgContLang->resetNamespaces();
                MWNamespace::clearCaches();
                // Reset namespace cache
                $wgContLang->resetNamespaces();