Follow-up r86775: restub $wgLang. Not because it's a good idea, but because I can...
[lhc/web/wiklou.git] / tests / phpunit / includes / ArticleTablesTest.php
1 <?php
2
3 /**
4 * @group Database
5 * @group Destructive
6 */
7 class ArticleTablesTest extends MediaWikiTestCase {
8
9 function setUp() {
10 global $wgLanguageCode;
11
12 $this->languageCode = $wgLanguageCode;
13 }
14
15 function tearDown() {
16 global $wgLanguageCode, $wgContLang, $wgLang;
17 $wgLanguageCode = $this->languageCode;
18 $wgContLang = Language::factory( $wgLanguageCode );
19 $wgLang = new StubUserLang;
20 }
21
22 /**
23 * @group Broken
24 */
25 function testbug14404() {
26 global $wgUser, $wgContLang, $wgLanguageCode, $wgLang;
27
28 $title = Title::newFromText("Bug 14404");
29 $article = new Article( $title );
30 $wgUser = new User();
31 $wgUser->mRights = array( 'createpage', 'edit', 'purge' );
32 $wgLanguageCode = 'es';
33 $wgContLang = Language::factory( 'es' );
34
35 $wgLang = Language::factory( 'fr' );
36 $status = $article->doEdit( '{{:{{int:history}}}}', 'Test code for bug 14404', 0 );
37 $templates1 = $article->getUsedTemplates();
38
39 $wgLang = Language::factory( 'de' );
40 $article->mParserOptions = null; // Let it pick the new user language
41 $article->mPreparedEdit = false; // In order to force the rerendering of the same wikitext
42
43 // We need an edit, a purge is not enough to regenerate the tables
44 $status = $article->doEdit( '{{:{{int:history}}}}', 'Test code for bug 14404', EDIT_UPDATE );
45 $templates2 = $article->getUsedTemplates();
46
47 $this->assertEquals( $templates1, $templates2 );
48 $this->assertEquals( $templates1[0]->getFullText(), 'Historial' );
49 }
50
51 }