+
+ public function provideGetPrefixedDBKey() {
+ return [
+ // ns = 0
+ [
+ Title::makeTitle( NS_MAIN, 'Foo_bar' ),
+ 'Foo_bar'
+ ],
+ // ns = 2
+ [
+ Title::makeTitle( NS_USER, 'Foo_bar' ),
+ 'User:Foo_bar'
+ ],
+ // ns = 3
+ [
+ Title::makeTitle( NS_USER_TALK, 'Foo_bar' ),
+ 'User_talk:Foo_bar'
+ ],
+ // fragment not included
+ [
+ Title::makeTitle( NS_MAIN, 'Foo_bar', 'fragment' ),
+ 'Foo_bar'
+ ],
+ // ns = -2
+ [
+ Title::makeTitle( NS_MEDIA, 'Foo_bar' ),
+ 'Media:Foo_bar'
+ ],
+ // non-existent namespace
+ [
+ Title::makeTitle( 100777, 'Foo_bar' ),
+ 'Special:Badtitle/NS100777:Foo_bar'
+ ],
+ ];
+ }
+
+ /**
+ * @covers Title::getPrefixedDBKey
+ * @dataProvider provideGetPrefixedDBKey
+ */
+ public function testGetPrefixedDBKey( Title $title, $expected ) {
+ $this->assertEquals( $expected, $title->getPrefixedDBkey() );
+ }