X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiQuerySiteinfoTest.php;h=dce1a5feef0e893398aecb875cbe00c45a6546fd;hb=a1ef77b2d80830fbcb617a83961d78cff9d6e384;hp=0a2558a227b91346af5c65dd2911bd99c0c053a2;hpb=543c5c1a1f985f3107ad1172933770bb761e54cf;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php b/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php index 0a2558a227..dce1a5feef 100644 --- a/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php +++ b/tests/phpunit/includes/api/ApiQuerySiteinfoTest.php @@ -79,15 +79,46 @@ class ApiQuerySiteinfoTest extends ApiTestCase { $this->assertSame( 'Need more donations', $data['readonlyreason'] ); } - public function testNamespaces() { - $this->setMwGlobals( 'wgExtraNamespaces', [ '138' => 'Testing' ] ); + public function testNamespacesBasic() { + $this->assertSame( + array_keys( MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces() ), + array_keys( $this->doQuery( 'namespaces' ) ) + ); + } + public function testNamespacesExtraNS() { + $this->setMwGlobals( 'wgExtraNamespaces', [ '138' => 'Testing' ] ); $this->assertSame( array_keys( MediaWikiServices::getInstance()->getContentLanguage()->getFormattedNamespaces() ), array_keys( $this->doQuery( 'namespaces' ) ) ); } + public function testNamespacesProtection() { + $this->setMwGlobals( + 'wgNamespaceProtection', + [ + '0' => '', + '2' => [ '' ], + '4' => 'editsemiprotected', + '8' => [ + 'editinterface', + 'noratelimit' + ], + '14' => [ + 'move-categorypages', + '' + ] + ] + ); + $data = $this->doQuery( 'namespaces' ); + $this->assertArrayNotHasKey( 'namespaceprotection', $data['0'] ); + $this->assertArrayNotHasKey( 'namespaceprotection', $data['2'] ); + $this->assertSame( 'editsemiprotected', $data['4']['namespaceprotection'] ); + $this->assertSame( 'editinterface|noratelimit', $data['8']['namespaceprotection'] ); + $this->assertSame( 'move-categorypages', $data['14']['namespaceprotection'] ); + } + public function testNamespaceAliases() { global $wgNamespaceAliases;