ldc-arcadia-api/tests/Unit/Application/Arcadia/Exceptions/IncoCompositionNotFoundExceptionTest.php

39 lines
1.2 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\Application\Arcadia\Exceptions;
use Application\Arcadia\Exceptions\IncoCompositionNotFoundException;
use Domain\Models\ValueObjects\Inco\IncoId;
use Shared\DDD\Exception\NotFoundException;
covers(IncoCompositionNotFoundException::class);
describe('IncoCompositionNotFoundException Unit Tests', function (): void {
it('creates exception for inco id value object', function (): void {
// GIVEN
$id = new IncoId('12345');
// WHEN
$exception = IncoCompositionNotFoundException::forInco($id);
// THEN
expect($exception)->toBeInstanceOf(NotFoundException::class)
->and($exception->getMessage())->toBe("IncoComposition for inco '12345' not found.");
});
it('creates exception for generic entity', function (): void {
// GIVEN
$entity = 'IncoComposition';
$id = '12345';
// WHEN
$exception = IncoCompositionNotFoundException::forEntity($entity, $id);
// THEN
expect($exception)->toBeInstanceOf(NotFoundException::class)
->and($exception->getMessage())->toBe("IncoComposition '12345' not found.");
});
});