X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FMWNamespaceTest.php;h=498532f76cab0bab2fabb7b61a7725ef6a0e7056;hb=97c5bc0a1ea20ed4f6c3e26b97dcd5d6f360a8ce;hp=f8de1ad964bf372acc55b617e6c982a90d309ab4;hpb=f9f12ba25270cce567b696b79730511a6ea81797;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index f8de1ad964..498532f76c 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -7,7 +7,6 @@ /** * Test class for MWNamespace. - * Generated by PHPUnit on 2011-02-20 at 21:01:55. * @todo covers tags * @todo FIXME: this test file is a mess */ @@ -162,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.' ); } */ @@ -224,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.' ); } */ @@ -235,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.' ); } */ @@ -246,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.' ); } */ @@ -258,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" ); } /**