Skip to content

Commit 12b201b

Browse files
committed
Keep Trying
1 parent eed339f commit 12b201b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
- name: Install locales
2929
run: sudo apt-get install -y language-pack-fr language-pack-de
3030

31+
- name: Install single-byte locale
32+
run: sudo sed -i -e 's/# de_DE@euro/de_DE@euro/g' /etc/locale.gen && sudo locale-gen de_DE@euro
33+
3134
- name: Setup PHP, with composer and extensions
3235
uses: shivammathur/setup-php@v2
3336
with:

tests/PhpSpreadsheetTests/Shared/StringHelperLocaleTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function tearDown(): void
3232

3333
public function testCurrency(): void
3434
{
35-
if (!setlocale(LC_ALL, 'de_DE.UTF-8', 'deu_deu.utf8')) {
35+
if ($this->currentLocale === false || !setlocale(LC_ALL, 'de_DE.UTF-8', 'deu_deu.utf8')) {
3636
self::markTestSkipped('Unable to set German UTF8 locale for testing.');
3737
}
3838
$result = StringHelper::getCurrencyCode();
@@ -46,10 +46,9 @@ public function testCurrency(): void
4646
$result = StringHelper::getCurrencyCode();
4747
self::assertSame('$', $result, 'locale now used');
4848
StringHelper::setCurrencyCode(null);
49-
if (!setlocale(LC_ALL, 'deu_deu', 'de_DE')) {
49+
if (!setlocale(LC_ALL, 'deu_deu', 'de_DE@euro')) {
5050
self::markTestSkipped('Unable to set German single-byte locale for testing.');
5151
}
52-
// Seems like Linux returns trailing blank, Win doesn't
5352
$result = StringHelper::getCurrencyCode(true); // trim if alt symbol is used
5453
self::assertSame('EUR', $result, 'non-UTF8 result ignored');
5554
}

0 commit comments

Comments
 (0)