From 12b201b0a4e17c4f83180b9e4691e840383f994d Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Mon, 23 Dec 2024 02:49:00 -0800 Subject: [PATCH] Keep Trying --- .github/workflows/main.yml | 3 +++ tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 01cbf16dc9..d640a0b8e8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,9 @@ jobs: - name: Install locales run: sudo apt-get install -y language-pack-fr language-pack-de + - name: Install single-byte locale + run: sudo sed -i -e 's/# de_DE@euro/de_DE@euro/g' /etc/locale.gen && sudo locale-gen de_DE@euro + - name: Setup PHP, with composer and extensions uses: shivammathur/setup-php@v2 with: diff --git a/tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php b/tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php index 505005cb41..c4178f53ab 100644 --- a/tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php +++ b/tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php @@ -32,7 +32,7 @@ protected function tearDown(): void public function testCurrency(): void { - if (!setlocale(LC_ALL, 'de_DE.UTF-8', 'deu_deu.utf8')) { + if ($this->currentLocale === false || !setlocale(LC_ALL, 'de_DE.UTF-8', 'deu_deu.utf8')) { self::markTestSkipped('Unable to set German UTF8 locale for testing.'); } $result = StringHelper::getCurrencyCode(); @@ -46,10 +46,9 @@ public function testCurrency(): void $result = StringHelper::getCurrencyCode(); self::assertSame('$', $result, 'locale now used'); StringHelper::setCurrencyCode(null); - if (!setlocale(LC_ALL, 'deu_deu', 'de_DE')) { + if (!setlocale(LC_ALL, 'deu_deu', 'de_DE@euro')) { self::markTestSkipped('Unable to set German single-byte locale for testing.'); } - // Seems like Linux returns trailing blank, Win doesn't $result = StringHelper::getCurrencyCode(true); // trim if alt symbol is used self::assertSame('EUR', $result, 'non-UTF8 result ignored'); }