Skip to content

Commit

Permalink
Keep Trying
Browse files Browse the repository at this point in the history
  • Loading branch information
oleibman committed Dec 23, 2024
1 parent eed339f commit 12b201b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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');
}
Expand Down

0 comments on commit 12b201b

Please sign in to comment.