Merge "Set relevant title on Special:RecentChangesLinked"
[lhc/web/wiklou.git] / tests / phpunit / includes / ArticleTablesTest.php
1 <?php
2
3 /**
4 * @group Database
5 */
6 class ArticleTablesTest extends MediaWikiLangTestCase {
7
8 /**
9 * @covers Title::getTemplateLinksFrom
10 * @covers Title::getLinksFrom
11 * @todo give this test a real name explaining what is being tested here
12 */
13 public function testbug14404() {
14 $title = Title::newFromText( 'Bug 14404' );
15 $page = WikiPage::factory( $title );
16 $user = new User();
17 $user->mRights = array( 'createpage', 'edit', 'purge' );
18 $this->setMwGlobals( 'wgLanguageCode', 'es' );
19 $this->setMwGlobals( 'wgContLang', Language::factory( 'es' ) );
20 $this->setMwGlobals( 'wgLang', Language::factory( 'fr' ) );
21
22 $page->doEditContent(
23 new WikitextContent( '{{:{{int:history}}}}' ),
24 'Test code for bug 14404',
25 0,
26 false,
27 $user
28 );
29 $templates1 = $title->getTemplateLinksFrom();
30
31 $this->setMwGlobals( 'wgLang', Language::factory( 'de' ) );
32 $page = WikiPage::factory( $title ); // In order to force the re-rendering of the same wikitext
33
34 // We need an edit, a purge is not enough to regenerate the tables
35 $page->doEditContent(
36 new WikitextContent( '{{:{{int:history}}}}' ),
37 'Test code for bug 14404',
38 EDIT_UPDATE,
39 false,
40 $user
41 );
42 $templates2 = $title->getTemplateLinksFrom();
43
44 /**
45 * @var Title[] $templates1
46 * @var Title[] $templates2
47 */
48 $this->assertEquals( $templates1, $templates2 );
49 $this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
50 }
51 }