Merge "Make LinkCache::isCacheable include namespaces like NS_CATEGORY/NS_MODULE"
[lhc/web/wiklou.git] / tests / phpunit / includes / MWNamespaceTest.php
index 15e2def..c95b1eb 100644 (file)
@@ -248,6 +248,7 @@ class MWNamespaceTest extends MediaWikiTestCase {
         * @param bool $expected
         */
        public function testCanTalk( $index, $expected ) {
+               $this->hideDeprecated( 'MWNamespace::canTalk' );
                $actual = MWNamespace::canTalk( $index );
                $this->assertSame( $actual, $expected, "NS $index" );
        }
@@ -575,4 +576,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" );
+       }
 }