MediaWiki  REL1_24
ArticleTablesTest.php
Go to the documentation of this file.
00001 <?php
00002 
00006 class ArticleTablesTest extends MediaWikiLangTestCase {
00015     public function testTemplatelinksUsesContentLanguage() {
00016         $title = Title::newFromText( 'Bug 14404' );
00017         $page = WikiPage::factory( $title );
00018         $user = new User();
00019         $user->mRights = array( 'createpage', 'edit', 'purge' );
00020         $this->setMwGlobals( 'wgLanguageCode', 'es' );
00021         $this->setMwGlobals( 'wgContLang', Language::factory( 'es' ) );
00022         $this->setMwGlobals( 'wgLang', Language::factory( 'fr' ) );
00023 
00024         $page->doEditContent(
00025             new WikitextContent( '{{:{{int:history}}}}' ),
00026             'Test code for bug 14404',
00027             0,
00028             false,
00029             $user
00030         );
00031         $templates1 = $title->getTemplateLinksFrom();
00032 
00033         $this->setMwGlobals( 'wgLang', Language::factory( 'de' ) );
00034         $page = WikiPage::factory( $title ); // In order to force the re-rendering of the same wikitext
00035 
00036         // We need an edit, a purge is not enough to regenerate the tables
00037         $page->doEditContent(
00038             new WikitextContent( '{{:{{int:history}}}}' ),
00039             'Test code for bug 14404',
00040             EDIT_UPDATE,
00041             false,
00042             $user
00043         );
00044         $templates2 = $title->getTemplateLinksFrom();
00045 
00050         $this->assertEquals( $templates1, $templates2 );
00051         $this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
00052     }
00053 }