Add @covers tags to objectcache tests
[lhc/web/wiklou.git] / tests / phpunit / includes / MWNamespaceTest.php
index 092d57b..498532f 100644 (file)
@@ -161,7 +161,7 @@ class MWNamespaceTest extends MediaWikiTestCase {
        public function testExists() {
                // Remove the following lines when you implement this test.
                $this->markTestIncomplete(
-                 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+                       'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
                );
        }
        */
@@ -223,7 +223,7 @@ class MWNamespaceTest extends MediaWikiTestCase {
        public function testGetCanonicalNamespaces() {
                // Remove the following lines when you implement this test.
                $this->markTestIncomplete(
-                 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+                       'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
                );
        }
        */
@@ -234,7 +234,7 @@ class MWNamespaceTest extends MediaWikiTestCase {
                public function testGetCanonicalName() {
                        // Remove the following lines when you implement this test.
                        $this->markTestIncomplete(
-                         'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+                               'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
                        );
                }
        */
@@ -245,7 +245,7 @@ class MWNamespaceTest extends MediaWikiTestCase {
        public function testGetCanonicalIndex() {
                // Remove the following lines when you implement this test.
                $this->markTestIncomplete(
-                 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+                       'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
                );
        }
        */
@@ -257,26 +257,48 @@ class MWNamespaceTest extends MediaWikiTestCase {
        public function testGetValidNamespaces() {
                // Remove the following lines when you implement this test.
                $this->markTestIncomplete(
-                 'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
+                       'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
                );
        }
        */
 
+       public function provideHasTalkNamespace() {
+               return [
+                       [ NS_MEDIA, false ],
+                       [ NS_SPECIAL, false ],
+
+                       [ NS_MAIN, true ],
+                       [ NS_TALK, true ],
+                       [ NS_USER, true ],
+                       [ NS_USER_TALK, true ],
+
+                       [ 100, true ],
+                       [ 101, true ],
+               ];
+       }
+
        /**
-        * @covers MWNamespace::canTalk
+        * @dataProvider provideHasTalkNamespace
+        * @covers MWNamespace::hasTalkNamespace
+        *
+        * @param int $index
+        * @param bool $expected
         */
-       public function testCanTalk() {
-               $this->assertCanNotTalk( NS_MEDIA );
-               $this->assertCanNotTalk( NS_SPECIAL );
-
-               $this->assertCanTalk( NS_MAIN );
-               $this->assertCanTalk( NS_TALK );
-               $this->assertCanTalk( NS_USER );
-               $this->assertCanTalk( NS_USER_TALK );
+       public function testHasTalkNamespace( $index, $expected ) {
+               $actual = MWNamespace::hasTalkNamespace( $index );
+               $this->assertSame( $actual, $expected, "NS $index" );
+       }
 
-               // User defined namespaces
-               $this->assertCanTalk( 100 );
-               $this->assertCanTalk( 101 );
+       /**
+        * @dataProvider provideHasTalkNamespace
+        * @covers MWNamespace::canTalk
+        *
+        * @param int $index
+        * @param bool $expected
+        */
+       public function testCanTalk( $index, $expected ) {
+               $actual = MWNamespace::canTalk( $index );
+               $this->assertSame( $actual, $expected, "NS $index" );
        }
 
        /**