X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FMWNamespaceTest.php;h=498532f76cab0bab2fabb7b61a7725ef6a0e7056;hb=5400ba91ac4fa2f75053f6e486a3cccd30885431;hp=092d57b3aae837fa148e3332294ae37710ca0d40;hpb=8bb5a6c461c31ee5ce6874548246fc2c520686f6;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index 092d57b3aa..498532f76c 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -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" ); } /**