31 lines
856 B
PHP
31 lines
856 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Shared\Enums;
|
|
|
|
use Shared\DDD\Exceptions\UnknownCountryIsoCodeException;
|
|
use Shared\Enums\Country;
|
|
|
|
covers(Country::class, UnknownCountryIsoCodeException::class);
|
|
|
|
describe('country', function (): void {
|
|
it('has the expected cases with their backing values', function (): void {
|
|
// THEN
|
|
expect(Country::FRANCE->value)->toBe('france')
|
|
->and(Country::BENELUX->value)->toBe('benelux');
|
|
});
|
|
|
|
it('exposes its case name', function (): void {
|
|
// THEN
|
|
expect(Country::FRANCE->name)->toBe('FRANCE');
|
|
});
|
|
|
|
it('is a domain exception', function (): void {
|
|
// GIVEN / WHEN
|
|
$exception = UnknownCountryIsoCodeException::fromIsoCode('XX');
|
|
|
|
// THEN
|
|
expect($exception)->toBeInstanceOf(\DomainException::class);
|
|
});
|
|
});
|