X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FMWNamespaceTest.php;h=1b91a87fb75a47d65d05f2d65c8163a8fb4b5222;hb=0770f85a0a293e6c7af6f1d3d3a1dbd2d13c1e09;hp=15e2defcb5f8af1aded7275700bbf5fe558698ab;hpb=882323309ff1e3ee45e1e89ee8e57484f54f6e32;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index 15e2defcb5..1b91a87fb7 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -575,4 +575,34 @@ class MWNamespaceTest extends MediaWikiTestCase { private function assertDifferentSubject( $ns1, $ns2, $msg = '' ) { $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg ); } + + public function provideGetCategoryLinkType() { + return [ + [ NS_MAIN, 'page' ], + [ NS_TALK, 'page' ], + [ NS_USER, 'page' ], + [ NS_USER_TALK, 'page' ], + + [ NS_FILE, 'file' ], + [ NS_FILE_TALK, 'page' ], + + [ NS_CATEGORY, 'subcat' ], + [ NS_CATEGORY_TALK, 'page' ], + + [ 100, 'page' ], + [ 101, 'page' ], + ]; + } + + /** + * @dataProvider provideGetCategoryLinkType + * @covers MWNamespace::getCategoryLinkType + * + * @param int $index + * @param string $expected + */ + public function testGetCategoryLinkType( $index, $expected ) { + $actual = MWNamespace::getCategoryLinkType( $index ); + $this->assertSame( $expected, $actual, "NS $index" ); + } }