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 (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:
parent
0eccb61c17
commit
f22260487a
@ -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