mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: tests now pass when the locale is set to something other than 'en_US' in the mysite's _config.php file (from r107940)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112702 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
93eb6214b7
commit
0e3693f99e
@ -407,6 +407,11 @@ PHP;
|
||||
}
|
||||
|
||||
function testCollectFromFilesystemAndWriteMasterTables() {
|
||||
$defaultlocal = i18n::default_locale();
|
||||
$local = i18n::get_locale();
|
||||
i18n::set_locale('en_US'); //set the locale to the US locale expected in the asserts
|
||||
i18n::set_default_locale('en_US');
|
||||
|
||||
$c = new i18nTextCollector();
|
||||
$c->basePath = $this->alternateBasePath;
|
||||
$c->baseSavePath = $this->alternateBaseSavePath;
|
||||
@ -466,6 +471,9 @@ PHP;
|
||||
"\$lang['en_US']['i18nOtherModule']['MAINTEMPLATE'] = 'Main Template Other Module';",
|
||||
$otherModuleLangFileContent
|
||||
);
|
||||
|
||||
i18n::set_locale($local); //set the locale to the US locale expected in the asserts
|
||||
+ i18n::set_default_locale($defaultlocal);
|
||||
}
|
||||
|
||||
function testCollectFromEntityProvidersInCustomObject() {
|
||||
|
@ -74,6 +74,9 @@ class MoneyTest extends SapphireTest {
|
||||
* is re-read properly.
|
||||
*/
|
||||
function testGettingWrittenDataObject() {
|
||||
$local = i18n::get_locale();
|
||||
i18n::set_locale('en_US'); //make sure that the $ amount is not prefixed by US$, as it would be in non-US locale
|
||||
|
||||
$obj = new MoneyTest_DataObject();
|
||||
|
||||
$m = new Money();
|
||||
@ -93,6 +96,8 @@ class MoneyTest extends SapphireTest {
|
||||
$this->assertEquals("$987.65", $moneyTest->MyMoney->Nice(),
|
||||
"Money field not added to data object properly when read."
|
||||
);
|
||||
|
||||
i18n::set_locale($local);
|
||||
}
|
||||
|
||||
public function testToCurrency() {
|
||||
|
@ -7,6 +7,21 @@ class MemberTest extends FunctionalTest {
|
||||
static $fixture_file = 'sapphire/tests/security/MemberTest.yml';
|
||||
|
||||
protected $orig = array();
|
||||
protected $local = null;
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
//Setting the locale has to happen in the constructor (using the setUp and tearDown methods doesn't work)
|
||||
//This is because the test relies on the yaml file being interpreted according to a particular date format
|
||||
//and this setup occurs before the setUp method is run
|
||||
$this->local = i18n::default_locale();
|
||||
i18n::set_default_locale('en_US');
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
i18n::set_default_locale($this->local);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
parent::setUp();
|
||||
|
@ -183,6 +183,9 @@ class SecurityTest extends FunctionalTest {
|
||||
}
|
||||
|
||||
function testRepeatedLoginAttemptsLockingPeopleOut() {
|
||||
$local = i18n::get_locale();
|
||||
i18n::set_locale('en_US');
|
||||
|
||||
Member::lock_out_after_incorrect_logins(5);
|
||||
|
||||
/* LOG IN WITH A BAD PASSWORD 7 TIMES */
|
||||
@ -239,6 +242,8 @@ class SecurityTest extends FunctionalTest {
|
||||
|
||||
$this->doTestLoginForm('sam@silverstripe.com' , '1nitialPassword');
|
||||
$this->assertEquals($this->session()->inst_get('loggedInAs'), $member->ID);
|
||||
|
||||
i18n::set_locale($local);
|
||||
}
|
||||
|
||||
function testAlternatingRepeatedLoginAttempts() {
|
||||
|
Loading…
Reference in New Issue
Block a user