Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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"
]
}
}
56 changes: 28 additions & 28 deletions tests/CurrencyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 => [
Expand Down Expand Up @@ -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);
}
}