MINOR: Save and restore lang state in test

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@104835 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Mark Stephens 2010-05-13 23:25:17 +00:00 committed by Sam Minnee
parent 8e1f2b645c
commit 9f0c83ef88

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) {