diff --git a/composer.json b/composer.json index ed38864..4ef1221 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,10 @@ "php": "^8.5" }, "require-dev": { - "ergebnis/composer-normalize": "^2.52", - "infection/infection": "^0.34", - "phpstan/phpstan": "^2.2", - "phpunit/phpunit": "^13.2", + "ergebnis/composer-normalize": "^2.54", + "infection/infection": "^0.35", + "phpstan/phpstan": "^2.3", + "phpunit/phpunit": "^13.4", "slevomat/coding-standard": "^8.31", "squizlabs/php_codesniffer": "^4.0" }, @@ -69,7 +69,7 @@ "test-file": "@php ./vendor/bin/phpunit --configuration phpunit.xml --no-coverage --filter", "tests": [ "@php -d memory_limit=2G ./vendor/bin/phpunit --configuration phpunit.xml tests", - "@php ./vendor/bin/infection --threads=max --logger-html=reports/coverage/mutation-report.html --coverage=reports/coverage" + "@php ./vendor/bin/infection --threads=max --logger-html=reports/coverage/mutation-report.html" ] } } diff --git a/tests/CurrencyTest.php b/tests/CurrencyTest.php index a718449..442bcad 100644 --- a/tests/CurrencyTest.php +++ b/tests/CurrencyTest.php @@ -9,6 +9,34 @@ final class CurrencyTest extends TestCase { + #[DataProvider('fractionDigitsDataProvider')] + public function testFractionDigitsWhenCurrencyIsAccessedThenReturnsExpectedNumber( + int $expected, + Currency $currency + ): void { + /** @Given a currency with a known number of fraction digits */ + + /** @When asking for the number of fraction digits */ + $actual = $currency->getFractionDigits(); + + /** @Then the returned number matches the expected one */ + self::assertSame($expected, $actual); + } + + #[DataProvider('currenciesDataProvider')] + public function testCurrencyCodeWhenAccessedThenNameAndValueAreThreeCharactersLong( + string $name, + string $value + ): void { + /** @Given a currency case from the data provider */ + + /** @When inspecting the lengths of the name and the value */ + + /** @Then both are exactly three characters long */ + self::assertSame(3, strlen($name)); + self::assertSame(3, strlen($value)); + } + public static function currenciesDataProvider(): array { return array_map(static fn(Currency $currency): array => [ @@ -50,32 +78,4 @@ public static function fractionDigitsDataProvider(): array 'Currency UYW with digits 4' => ['currency' => Currency::UYW, 'expected' => 4] ]; } - - #[DataProvider('currenciesDataProvider')] - public function testCurrencyCodeWhenAccessedThenNameAndValueAreThreeCharactersLong( - string $name, - string $value - ): void { - /** @Given a currency case from the data provider */ - - /** @When inspecting the lengths of the name and the value */ - - /** @Then both are exactly three characters long */ - self::assertSame(3, strlen($name)); - self::assertSame(3, strlen($value)); - } - - #[DataProvider('fractionDigitsDataProvider')] - public function testFractionDigitsWhenCurrencyIsAccessedThenReturnsExpectedNumber( - int $expected, - Currency $currency - ): void { - /** @Given a currency with a known number of fraction digits */ - - /** @When asking for the number of fraction digits */ - $actual = $currency->getFractionDigits(); - - /** @Then the returned number matches the expected one */ - self::assertSame($expected, $actual); - } }