Fix the temporary file garbage collection which was not occuring on lang tests. Fix at least: (bug 37252) filebackend-unittest temp dirs not deleted Change-Id: I446d5ad21c8a3b12020e2424d09ba71dde410221
42 lines
1 KiB
PHP
42 lines
1 KiB
PHP
<?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();
|
|
}
|
|
|
|
}
|