X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTitleTest.php;h=b0febe8d5fdcce29a75e8ca8e79bccde6230a2f1;hp=7770cbc2c3a18f58c2a0fd02c77455e5575fe6cc;hb=3df3b575c6617df64ec98533cc7141bd2314e274;hpb=d5a7166771613dfe4ed9fb75fa5efeced6134bd1 diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index 7770cbc2c3..b0febe8d5f 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -637,6 +637,28 @@ class TitleTest extends MediaWikiTestCase { ]; } + /** + * @covers Title::isValid + * @dataProvider provideIsValid + * @param Title $title + * @param bool $isValid + */ + public function testIsValid( Title $title, $isValid ) { + $this->assertEquals( $isValid, $title->isValid(), $title->getPrefixedText() ); + } + + public static function provideIsValid() { + return [ + [ Title::makeTitle( NS_MAIN, '' ), false ], + [ Title::makeTitle( NS_MAIN, '<>' ), false ], + [ Title::makeTitle( NS_MAIN, '|' ), false ], + [ Title::makeTitle( NS_MAIN, '#' ), false ], + [ Title::makeTitle( NS_MAIN, 'Test' ), true ], + [ Title::makeTitle( -33, 'Test' ), false ], + [ Title::makeTitle( 77663399, 'Test' ), false ], + ]; + } + /** * @covers Title::isAlwaysKnown */