blob: 6dd8ea35c2496a38d8c73543572f1e755265365a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
/**
* Base class that store and restore the Language objects
*/
abstract class MediaWikiLangTestCase extends MediaWikiTestCase {
private static $oldLang;
private static $oldContLang;
public function setUp() {
global $wgLanguageCode, $wgLang, $wgContLang;
parent::setUp();
self::$oldLang = $wgLang;
self::$oldContLang = $wgContLang;
if( $wgLanguageCode != $wgContLang->getCode() ) {
throw new MWException("Error in MediaWikiLangTestCase::setUp(): " .
"\$wgLanguageCode ('$wgLanguageCode') is different from " .
"\$wgContLang->getCode() (" . $wgContLang->getCode() . ")" );
}
$wgLanguageCode = 'en'; # For mainpage to be 'Main Page'
$wgContLang = $wgLang = Language::factory( $wgLanguageCode );
MessageCache::singleton()->disable();
}
public function tearDown() {
global $wgContLang, $wgLang, $wgLanguageCode;
$wgLang = self::$oldLang;
$wgContLang = self::$oldContLang;
$wgLanguageCode = $wgContLang->getCode();
self::$oldContLang = self::$oldLang = null;
parent::tearDown();
}
}
|