Skip to content

Commit

Permalink
Locale testing - Activate locales before using them
Browse files Browse the repository at this point in the history
  • Loading branch information
totten committed Aug 18, 2022
1 parent 72c8bac commit bc77245
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/phpunit/CRM/Case/Form/CustomDataTest.php
Expand Up @@ -87,6 +87,10 @@ public function testChangeCustomDataFormattedDetails(array $input, array $expect
* @param array $expected
*/
public function testChangeCustomDataFormattedDetailsLocale(array $input, array $expected) {
$enableLocales = CRM_Utils_AutoClean::swapSettings([
'uiLanguages' => ['en_US', 'it_IT'],
]);

CRM_Core_I18n::singleton()->setLocale('it_IT');
CRM_Core_Config::singleton()->defaultCurrency = 'EUR';
CRM_Core_Config::singleton()->monetaryThousandSeparator = ' ';
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/CRM/Utils/DateTest.php
Expand Up @@ -334,6 +334,9 @@ public function testLocalizeConsts() {
$expect['en_US'] = ['Jan', 'Tue', 'March', 'Thursday'];
$expect['fr_FR'] = ['janv.', 'mar.', 'mars', 'jeudi'];
$expect['es_MX'] = ['ene.', 'mar.', 'Marzo', 'jueves'];
$enableLocales = CRM_Utils_AutoClean::swapSettings([
'uiLanguages' => array_keys($expect),
]);

foreach ($expect as $lang => $expectNames) {
$useLocale = CRM_Utils_AutoClean::swapLocale($lang);
Expand Down
4 changes: 4 additions & 0 deletions tests/phpunit/CRM/Utils/TokenConsistencyTest.php
Expand Up @@ -238,6 +238,10 @@ public function testContributionRecurTokenRaw(): void {
* @group locale
*/
public function testMoneyFormat(): void {
$enableLocales = CRM_Utils_AutoClean::swapSettings([
'uiLanguages' => ['en_US', 'nb_NO'],
]);

// Our 'migration' off configured thousand separators at the moment is a define.
putenv('IGNORE_SEPARATOR_CONFIG=1');
$this->createLoggedInUser();
Expand Down

0 comments on commit bc77245

Please sign in to comment.