From 5d1f742bc5d2df0e17278d833e17c4635a33fa52 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Fri, 26 Jan 2024 13:58:31 +0100 Subject: [PATCH 1/2] tests: mark test as skippable if locale is not available --- tests/MoneyTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/MoneyTest.php b/tests/MoneyTest.php index 1827ba8d..74aa993f 100644 --- a/tests/MoneyTest.php +++ b/tests/MoneyTest.php @@ -99,7 +99,11 @@ public function itMultipliesTheAmount(int|string $multiplier, int $roundingMode, */ public function itMultipliesTheAmountWithLocaleThatUsesCommaSeparator(): void { - $this->setLocale(LC_ALL, 'es_ES.utf8'); + try { + $this->setLocale(LC_ALL, 'es_ES.utf8'); + } catch (\Throwable) { + $this->markTestSkipped('The locale es_ES.utf8 is not available.'); + } $money = new Money(100, new Currency(self::CURRENCY)); $money = $money->multiply('0.1'); From 8996117b020a58ad69ec882452a6a71f15e8be72 Mon Sep 17 00:00:00 2001 From: Christopher Georg Date: Fri, 26 Jan 2024 16:27:37 +0100 Subject: [PATCH 2/2] tests: change locale for test to 'en_US.UTF-8' --- tests/MoneyTest.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/MoneyTest.php b/tests/MoneyTest.php index 74aa993f..4244daca 100644 --- a/tests/MoneyTest.php +++ b/tests/MoneyTest.php @@ -99,11 +99,7 @@ public function itMultipliesTheAmount(int|string $multiplier, int $roundingMode, */ public function itMultipliesTheAmountWithLocaleThatUsesCommaSeparator(): void { - try { - $this->setLocale(LC_ALL, 'es_ES.utf8'); - } catch (\Throwable) { - $this->markTestSkipped('The locale es_ES.utf8 is not available.'); - } + $this->setLocale(LC_ALL, 'en_US.UTF-8'); $money = new Money(100, new Currency(self::CURRENCY)); $money = $money->multiply('0.1');