Remove $wgDebugFunctionEntry, unused
[mediawiki.git] / tests / phpunit / includes / title / NaiveForeignTitleFactoryTest.php
blob5d613db3dcf374ab1a2c418e242385de088b4ece
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
19 * @license GPL 2+
20 * @author This, that and the other
23 /**
24 * @covers NaiveForeignTitleFactory
26 * @group Title
28 class NaiveForeignTitleFactoryTest extends MediaWikiTestCase {
30 public function basicProvider() {
31 return array(
32 array(
33 'MainNamespaceArticle', 0,
34 new ForeignTitle( 0, '', 'MainNamespaceArticle' ),
36 array(
37 'MainNamespaceArticle', null,
38 new ForeignTitle( null, '', 'MainNamespaceArticle' ),
40 array(
41 'Talk:Nice_talk', 1,
42 new ForeignTitle( 1, 'Talk', 'Nice_talk' ),
44 array(
45 'Bogus:Nice_talk', 0,
46 new ForeignTitle( 0, '', 'Bogus:Nice_talk' ),
48 array(
49 'Bogus:Nice_talk', 9000, // non-existent local namespace ID
50 new ForeignTitle( 9000, 'Bogus', 'Nice_talk' ),
52 array(
53 'Bogus:Nice_talk', 4, // existing local namespace ID
54 new ForeignTitle( 4, 'Bogus', 'Nice_talk' ),
56 array(
57 'Talk:Extra:Nice_talk', 1,
58 new ForeignTitle( 1, 'Talk', 'Extra:Nice_talk' ),
60 array(
61 'Talk:Extra:Nice_talk', null,
62 new ForeignTitle( null, 'Talk', 'Extra:Nice_talk' ),
67 /**
68 * @dataProvider basicProvider
70 public function testBasic( $title, $ns, ForeignTitle $foreignTitle ) {
71 $factory = new NaiveForeignTitleFactory();
72 $testTitle = $factory->createForeignTitle( $title, $ns );
74 $this->assertEquals( $testTitle->isNamespaceIdKnown(),
75 $foreignTitle->isNamespaceIdKnown() );
77 if (
78 $testTitle->isNamespaceIdKnown() &&
79 $foreignTitle->isNamespaceIdKnown()
80 ) {
81 $this->assertEquals( $testTitle->getNamespaceId(),
82 $foreignTitle->getNamespaceId() );
85 $this->assertEquals( $testTitle->getNamespaceName(),
86 $foreignTitle->getNamespaceName() );
87 $this->assertEquals( $testTitle->getText(), $foreignTitle->getText() );
89 $this->assertEquals( str_replace( ' ', '_', $title ),
90 $foreignTitle->getFullText() );