[ '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' ],
]
]
] );
+
+ // Reset TitleParser since we modified $wgLocalInterwikis
+ $this->setService( 'TitleParser', new MediaWikiTitleCodec(
+ Language::factory( 'en' ),
+ new GenderCache(),
+ [ 'localtestiw' ]
+ ) );
}
/**
$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() );
+ }
}