Skip to content

Commit

Permalink
Add missing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank committed Jul 10, 2023
1 parent b72f10a commit 7bfb804
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Unit/Currency/CurrencyAlpha3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
16 changes: 16 additions & 0 deletions tests/Unit/Currency/CurrencyNameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
16 changes: 16 additions & 0 deletions tests/Unit/Currency/CurrencyNumericTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
64 changes: 64 additions & 0 deletions tests/Unit/Currency/CurrencySymbolTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php
declare(strict_types=1);

namespace PrinsFrank\Standards\Tests\Unit\Currency;

use PHPUnit\Framework\TestCase;
use PrinsFrank\Standards\Currency\CurrencyAlpha3;
use PrinsFrank\Standards\Currency\CurrencyName;
use PrinsFrank\Standards\Currency\CurrencyNumeric;
use TypeError;

/**
* @coversDefaultClass \PrinsFrank\Standards\Currency\CurrencySymbol
*/
class CurrencySymbolTest extends TestCase
{
/**
* @covers ::getSymbol
*/
public function testAllAlpha3CasesHaveAccessToSymbolOrNull(): 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 ::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));
}
}
}
}

0 comments on commit 7bfb804

Please sign in to comment.