MINOR: Save and restore lang state in test (from r104835)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112397 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-10-15 01:16:13 +00:00
parent 0eccb61c17
commit f22260487a

View File

@ -213,6 +213,9 @@ class i18nTest extends SapphireTest {
function testRegisteredPlugin() { function testRegisteredPlugin() {
global $lang; global $lang;
// save lang state, if we don't do this we may break other tests
$oldLang = $lang;
$lang = array(); // clear translations $lang = array(); // clear translations
i18n::register_plugin("testPlugin", array("i18nTest", "translationTestPlugin")); i18n::register_plugin("testPlugin", array("i18nTest", "translationTestPlugin"));
@ -226,6 +229,8 @@ class i18nTest extends SapphireTest {
i18n::set_locale('de_DE'); i18n::set_locale('de_DE');
$this->assertEquals(_t("i18nTestProvider.foo"), "bar_de"); $this->assertEquals(_t("i18nTestProvider.foo"), "bar_de");
i18n::unregister_plugin("testTranslator"); i18n::unregister_plugin("testTranslator");
$lang = $oldLang;
} }
static function translationTestPlugin($locale) { static function translationTestPlugin($locale) {