summaryrefslogtreecommitdiff
path: root/tests/phpunit/MediaWikiLangTestCase.php
blob: 1cd6a3ba6f48366d2a204786ad01e91ae23c64d1 (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
<?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;

		self::$oldLang = $wgLang;
		self::$oldContLang = $wgContLang;

		if( $wgLanguageCode != $wgContLang->getCode() ) die("nooo!");

		$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;
	}

}