SECURITY: blacklist CSS var()
[lhc/web/wiklou.git] / tests / phpunit / includes / PagePropsTest.php
index f602cda..222b3e3 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * @covers PageProps
  *
@@ -27,18 +29,20 @@ class PagePropsTest extends MediaWikiLangTestCase {
        private $the_properties;
 
        protected function setUp() {
-               global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
-
                parent::setUp();
 
-               $wgExtraNamespaces[12312] = 'Dummy';
-               $wgExtraNamespaces[12313] = 'Dummy_talk';
-
-               $wgNamespaceContentModels[12312] = 'DUMMY';
-               $wgContentHandlers['DUMMY'] = 'DummyContentHandlerForTesting';
+               $this->setMwGlobals( [
+                       'wgExtraNamespaces' => [
+                               12312 => 'Dummy',
+                               12313 => 'Dummy_talk',
+                       ],
+                       'wgNamespaceContentModels' => [ 12312 => 'DUMMY' ],
+               ] );
 
-               MWNamespace::clearCaches();
-               $wgContLang->resetNamespaces(); # reset namespace cache
+               $this->mergeMwGlobalArrayValue(
+                       'wgContentHandlers',
+                       [ 'DUMMY' => 'DummyContentHandlerForTesting' ]
+               );
 
                if ( !$this->the_properties ) {
                        $this->the_properties = [
@@ -72,21 +76,6 @@ class PagePropsTest extends MediaWikiLangTestCase {
                }
        }
 
-       protected function tearDown() {
-               global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
-
-               parent::tearDown();
-
-               unset( $wgExtraNamespaces[12312] );
-               unset( $wgExtraNamespaces[12313] );
-
-               unset( $wgNamespaceContentModels[12312] );
-               unset( $wgContentHandlers['DUMMY'] );
-
-               MWNamespace::clearCaches();
-               $wgContLang->resetNamespaces(); # reset namespace cache
-       }
-
        /**
         * Test getting a single property from a single page. The property was
         * set in setUp().
@@ -247,7 +236,8 @@ class PagePropsTest extends MediaWikiLangTestCase {
                                ( $model === null || $model === CONTENT_MODEL_WIKITEXT )
                        ) {
                                $ns = $this->getDefaultWikitextNS();
-                               $page = MWNamespace::getCanonicalName( $ns ) . ':' . $page;
+                               $page = MediaWikiServices::getInstance()->getNamespaceInfo()->
+                                       getCanonicalName( $ns ) . ':' . $page;
                        }
 
                        $page = Title::newFromText( $page );