From 1b4827db01abb652d82ca55f777dea5440eefd3c Mon Sep 17 00:00:00 2001 From: jmleroux Date: Thu, 11 Nov 2021 00:18:08 +0100 Subject: [PATCH] Fix integration tests when no locale with comma separator available --- tests/Spout/Writer/ODS/WriterTest.php | 5 +++++ tests/Spout/Writer/XLSX/WriterTest.php | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tests/Spout/Writer/ODS/WriterTest.php b/tests/Spout/Writer/ODS/WriterTest.php index a9aaa0e..100c5b5 100644 --- a/tests/Spout/Writer/ODS/WriterTest.php +++ b/tests/Spout/Writer/ODS/WriterTest.php @@ -291,12 +291,17 @@ class WriterTest extends TestCase // Installed locales differ from one system to another, so we can't pick // a given locale. $supportedLocales = explode("\n", shell_exec('locale -a')); + $foundCommaLocale = false; foreach ($supportedLocales as $supportedLocale) { \setlocale(LC_ALL, $supportedLocale); if (\localeconv()['decimal_point'] === ',') { + $foundCommaLocale = true; break; } } + if (!$foundCommaLocale) { + $this->markTestSkipped('No locale with comma decimal separator'); + } $this->assertEquals(',', \localeconv()['decimal_point']); $fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx'; diff --git a/tests/Spout/Writer/XLSX/WriterTest.php b/tests/Spout/Writer/XLSX/WriterTest.php index 26b3792..43ee097 100644 --- a/tests/Spout/Writer/XLSX/WriterTest.php +++ b/tests/Spout/Writer/XLSX/WriterTest.php @@ -406,12 +406,17 @@ class WriterTest extends TestCase // Installed locales differ from one system to another, so we can't pick // a given locale. $supportedLocales = explode("\n", shell_exec('locale -a')); + $foundCommaLocale = false; foreach ($supportedLocales as $supportedLocale) { \setlocale(LC_ALL, $supportedLocale); if (\localeconv()['decimal_point'] === ',') { + $foundCommaLocale = true; break; } } + if (!$foundCommaLocale) { + $this->markTestSkipped('No locale with comma decimal separator'); + } $this->assertEquals(',', \localeconv()['decimal_point']); $fileName = 'test_add_row_should_support_float_values_in_different_locale.xlsx';