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

37 lines
1.1 KiB
PHP

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