X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FPagePropsTest.php;h=222b3e3a024d0170c02138f10bf2f886d7f1e9bf;hp=f602cdabcf45f386bc0caeec20a9b4cb0f042f13;hb=4260b0f8a9bb89d92c39a61d8c48a31007b7240f;hpb=63eebc01c48aee45f9c219cadf2e0e81f5a2043e diff --git a/tests/phpunit/includes/PagePropsTest.php b/tests/phpunit/includes/PagePropsTest.php index f602cdabcf..222b3e3a02 100644 --- a/tests/phpunit/includes/PagePropsTest.php +++ b/tests/phpunit/includes/PagePropsTest.php @@ -1,5 +1,7 @@ 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 );