MediaWiki REL1_31
NamespaceImportTitleFactoryTest.php
Go to the documentation of this file.
1<?php
28
29 protected function setUp() {
30 parent::setUp();
31
32 $this->setMwGlobals( [
33 'wgLanguageCode' => 'en',
34 'wgContLang' => Language::factory( 'en' ),
35 ] );
36 }
37
38 public function basicProvider() {
39 return [
40 [
41 new ForeignTitle( 0, '', 'MainNamespaceArticle' ),
42 0,
43 'MainNamespaceArticle'
44 ],
45 [
46 new ForeignTitle( 0, '', 'MainNamespaceArticle' ),
47 2,
48 'User:MainNamespaceArticle'
49 ],
50 [
51 new ForeignTitle( 1, 'Discussion', 'Nice_talk' ),
52 0,
53 'Nice_talk'
54 ],
55 [
56 new ForeignTitle( 0, '', 'Bogus:Nice_talk' ),
57 0,
58 'Bogus:Nice_talk'
59 ],
60 [
61 new ForeignTitle( 0, '', 'Bogus:Nice_talk' ),
62 2,
63 'User:Bogus:Nice_talk'
64 ],
65 ];
66 }
67
71 public function testBasic( ForeignTitle $foreignTitle, $ns, $titleText ) {
72 $factory = new NamespaceImportTitleFactory( $ns );
73 $testTitle = $factory->createTitleFromForeignTitle( $foreignTitle );
74 $title = Title::newFromText( $titleText );
75
76 $this->assertTrue( $title->equals( $testTitle ) );
77 }
78}
A simple, immutable structure to hold the title of a page on a foreign MediaWiki installation.
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
testBasic(ForeignTitle $foreignTitle, $ns, $titleText)
basicProvider
A class to convert page titles on a foreign wiki (ForeignTitle objects) into page titles on the local...