Fix integration tests when no locale with comma separator available

This commit is contained in:
jmleroux committed 2021-11-11 00:18:08 +01:00
1 parent e61261fc74
commit 1b4827db01
2 files changed
+10

No files matched your search

+5
View File
@@ -291,12 +291,17 @@ class WriterTest extends TestCase
// Installed locales differ from one system to another, so we can't pick // Installed locales differ from one system to another, so we can't pick
// a given locale. // a given locale.
$supportedLocales = explode("\n", shell_exec('locale -a')); $supportedLocales = explode("\n", shell_exec('locale -a'));
$foundCommaLocale = false;
foreach ($supportedLocales as $supportedLocale) { foreach ($supportedLocales as $supportedLocale) {
\setlocale(LC_ALL, $supportedLocale); \setlocale(LC_ALL, $supportedLocale);
if (\localeconv()['decimal_point'] === ',') { if (\localeconv()['decimal_point'] === ',') {
$foundCommaLocale = true;
break; break;
} }
} }
if (!$foundCommaLocale) {
$this->markTestSkipped('No locale with comma decimal separator');
}
$this->assertEquals(',', \localeconv()['decimal_point']); $this->assertEquals(',', \localeconv()['decimal_point']);
$fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx'; $fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';
+5
View File
@@ -406,12 +406,17 @@ class WriterTest extends TestCase
// Installed locales differ from one system to another, so we can't pick // Installed locales differ from one system to another, so we can't pick
// a given locale. // a given locale.
$supportedLocales = explode("\n", shell_exec('locale -a')); $supportedLocales = explode("\n", shell_exec('locale -a'));
$foundCommaLocale = false;
foreach ($supportedLocales as $supportedLocale) { foreach ($supportedLocales as $supportedLocale) {
\setlocale(LC_ALL, $supportedLocale); \setlocale(LC_ALL, $supportedLocale);
if (\localeconv()['decimal_point'] === ',') { if (\localeconv()['decimal_point'] === ',') {
$foundCommaLocale = true;
break; break;
} }
} }
if (!$foundCommaLocale) {
$this->markTestSkipped('No locale with comma decimal separator');
}
$this->assertEquals(',', \localeconv()['decimal_point']); $this->assertEquals(',', \localeconv()['decimal_point']);
$fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx'; $fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';