mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
8e1f2b645c
commit
9f0c83ef88
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user