X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FTitleTest.php;h=7925c6f8f95e24616d01b883efb6c6213a690f46;hb=82d3ab93ad15a34089ab81a9a9d62ecd3d2e48ec;hp=496f18f796b84f61127f12df7330e7917c3dcf0d;hpb=6fcabeeb0b400b0d2987b6c934e6c1b591e7b486;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/TitleTest.php b/tests/phpunit/includes/TitleTest.php index 496f18f796..7925c6f8f9 100644 --- a/tests/phpunit/includes/TitleTest.php +++ b/tests/phpunit/includes/TitleTest.php @@ -90,6 +90,8 @@ class TitleTest extends MediaWikiTestCase { [ 'A < B', 'title-invalid-characters' ], [ 'A > B', 'title-invalid-characters' ], [ 'A | B', 'title-invalid-characters' ], + [ "A \t B", 'title-invalid-characters' ], + [ "A \n B", 'title-invalid-characters' ], // URL encoding [ 'A%20B', 'title-invalid-characters' ], [ 'A%23B', 'title-invalid-characters' ], @@ -709,4 +711,42 @@ class TitleTest extends MediaWikiTestCase { $this->assertEquals( $title->getInterwiki(), $fragmentTitle->getInterwiki() ); $this->assertEquals( $fragment, $fragmentTitle->getFragment() ); } + + public function provideGetPrefixedText() { + return [ + // ns = 0 + [ + Title::makeTitle( NS_MAIN, 'Foobar' ), + 'Foobar' + ], + // ns = 2 + [ + Title::makeTitle( NS_USER, 'Foobar' ), + 'User:Foobar' + ], + // fragment not included + [ + Title::makeTitle( NS_MAIN, 'Foobar', 'fragment' ), + 'Foobar' + ], + // ns = -2 + [ + Title::makeTitle( NS_MEDIA, 'Foobar' ), + 'Media:Foobar' + ], + // non-existent namespace + [ + Title::makeTitle( 100000, 'Foobar' ), + ':Foobar' + ], + ]; + } + + /** + * @covers Title::getPrefixedText + * @dataProvider provideGetPrefixedText + */ + public function testGetPrefixedText( Title $title, $expected ) { + $this->assertEquals( $expected, $title->getPrefixedText() ); + } }