From 7bfb8049c522b8867c9fecf9719d81c28b872782 Mon Sep 17 00:00:00 2001 From: PrinsFrank Date: Mon, 10 Jul 2023 20:41:58 +0300 Subject: [PATCH] Add missing test cases --- tests/Unit/Currency/CurrencyAlpha3Test.php | 16 ++++++ tests/Unit/Currency/CurrencyNameTest.php | 16 ++++++ tests/Unit/Currency/CurrencyNumericTest.php | 16 ++++++ tests/Unit/Currency/CurrencySymbolTest.php | 64 +++++++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100644 tests/Unit/Currency/CurrencySymbolTest.php diff --git a/tests/Unit/Currency/CurrencyAlpha3Test.php b/tests/Unit/Currency/CurrencyAlpha3Test.php index 274b9cea..9e64783a 100644 --- a/tests/Unit/Currency/CurrencyAlpha3Test.php +++ b/tests/Unit/Currency/CurrencyAlpha3Test.php @@ -44,6 +44,22 @@ public function testAllCasesCanBeConvertedToCurrencyName(): void } } + /** + * @covers ::getSymbol + */ + public function testAllCasesHaveAccessToSymbolOrNull(): void + { + $cases = CurrencyAlpha3::cases(); + static::assertNotEmpty($cases); + foreach ($cases as $case) { + try { + $case->getSymbol(); + } catch (TypeError) { + $this->fail(sprintf('Unable to retrieve symbol for %s', $case->name)); + } + } + } + /** * @covers ::lowerCaseValue */ diff --git a/tests/Unit/Currency/CurrencyNameTest.php b/tests/Unit/Currency/CurrencyNameTest.php index eca33fe6..c83d37eb 100644 --- a/tests/Unit/Currency/CurrencyNameTest.php +++ b/tests/Unit/Currency/CurrencyNameTest.php @@ -28,6 +28,22 @@ public function testAllCasesCanBeConvertedToCurrencyNumeric(): void } } + /** + * @covers ::getSymbol + */ + public function testAllCasesHaveAccessToSymbolOrNull(): void + { + $cases = CurrencyName::cases(); + static::assertNotEmpty($cases); + foreach ($cases as $case) { + try { + $case->getSymbol(); + } catch (TypeError) { + $this->fail(sprintf('Unable to retrieve symbol for %s', $case->name)); + } + } + } + /** * @covers ::toCurrencyAlpha3 */ diff --git a/tests/Unit/Currency/CurrencyNumericTest.php b/tests/Unit/Currency/CurrencyNumericTest.php index 49e1a1f4..c1e8367f 100644 --- a/tests/Unit/Currency/CurrencyNumericTest.php +++ b/tests/Unit/Currency/CurrencyNumericTest.php @@ -45,6 +45,22 @@ public function testAllCasesCanBeConvertedToCurrencyName(): void } } + /** + * @covers ::getSymbol + */ + public function testAllCasesHaveAccessToSymbolOrNull(): void + { + $cases = CurrencyNumeric::cases(); + static::assertNotEmpty($cases); + foreach ($cases as $case) { + try { + $case->getSymbol(); + } catch (TypeError) { + $this->fail(sprintf('Unable to retrieve symbol for %s', $case->name)); + } + } + } + /** * @covers ::fromInt */ diff --git a/tests/Unit/Currency/CurrencySymbolTest.php b/tests/Unit/Currency/CurrencySymbolTest.php new file mode 100644 index 00000000..87aef4b1 --- /dev/null +++ b/tests/Unit/Currency/CurrencySymbolTest.php @@ -0,0 +1,64 @@ +getSymbol(); + } catch (TypeError) { + $this->fail(sprintf('Unable to retrieve symbol for %s', $case->name)); + } + } + } + + /** + * @covers ::getSymbol + */ + public function testAllNameCasesHaveAccessToSymbolOrNull(): void + { + $cases = CurrencyName::cases(); + static::assertNotEmpty($cases); + foreach ($cases as $case) { + try { + $case->getSymbol(); + } catch (TypeError) { + $this->fail(sprintf('Unable to retrieve symbol for %s', $case->name)); + } + } + } + + /** + * @covers ::getSymbol + */ + public function testAllNumericCasesHaveAccessToSymbolOrNull(): void + { + $cases = CurrencyNumeric::cases(); + static::assertNotEmpty($cases); + foreach ($cases as $case) { + try { + $case->getSymbol(); + } catch (TypeError) { + $this->fail(sprintf('Unable to retrieve symbol for %s', $case->name)); + } + } + } +}