X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FPagePropsTest.php;h=222b3e3a024d0170c02138f10bf2f886d7f1e9bf;hb=8f1d9e171891a5f1613ae4819dbb140261333f83;hp=cc1708a2b40aade2d3e2d9d2adb9cb30ddc92f46;hpb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/PagePropsTest.php b/tests/phpunit/includes/PagePropsTest.php index cc1708a2b4..222b3e3a02 100644 --- a/tests/phpunit/includes/PagePropsTest.php +++ b/tests/phpunit/includes/PagePropsTest.php @@ -1,13 +1,17 @@ setMwGlobals( [ + 'wgExtraNamespaces' => [ + 12312 => 'Dummy', + 12313 => 'Dummy_talk', + ], + 'wgNamespaceContentModels' => [ 12312 => 'DUMMY' ], + ] ); - MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache - $wgContLang->resetNamespaces(); # reset namespace cache + $this->mergeMwGlobalArrayValue( + 'wgContentHandlers', + [ 'DUMMY' => 'DummyContentHandlerForTesting' ] + ); if ( !$this->the_properties ) { $this->the_properties = [ @@ -70,21 +76,6 @@ class TestPageProps 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::getCanonicalNamespaces( true ); # reset namespace cache - $wgContLang->resetNamespaces(); # reset namespace cache - } - /** * Test getting a single property from a single page. The property was * set in setUp(). @@ -245,7 +236,8 @@ class TestPageProps 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 ); @@ -266,11 +258,9 @@ class TestPageProps extends MediaWikiLangTestCase { } protected function setProperties( $pageID, $properties ) { - $rows = []; foreach ( $properties as $propertyName => $propertyValue ) { - $row = [ 'pp_page' => $pageID, 'pp_propname' => $propertyName, @@ -295,11 +285,9 @@ class TestPageProps extends MediaWikiLangTestCase { } protected function setProperty( $pageID, $propertyName, $propertyValue ) { - $properties = []; $properties[$propertyName] = $propertyValue; $this->setProperties( $pageID, $properties ); - } }