ldc-arcadia-api/tests/Unit/Domain/Models/ValueObjects/ServiceIdTest.php
Jérémy Munsch 152ee2b5a2
feat(api): add IncoSheets feature with DDD clean architecture, tests & OpenAPI spec
- Use cases: FindAllIncoSheets & FindIncoSheet (filters, pagination, short projection)
- Presentation: controllers, FormRequests with scalar validation, DTOs (camelCase)
- Ports & Adapters: IncoSheetDirectory & EloquentIncoSheetDirectory
- Tests: Pest 4 unit, integration, OpenAPI spectator conformance, dynamic arch tests
- Docs: updated Bruno collection and OpenAPI spec
2026-08-14 11:33:05 +02:00

30 lines
842 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects;
use Domain\Models\ValueObjects\ServiceId;
covers(ServiceId::class);
describe('ServiceId Value Object Instantiation', function (): void {
it('accepts valid numeric service identifiers', function (string $input): void {
// GIVEN
$value = $input;
// WHEN
$vo = new ServiceId($value);
// THEN
expect($vo->value)->toBe($value);
})->with(['097', '1', '12345']);
});
describe('ServiceId Value Object Domain Rules', function (): void {
it('rejects non-numeric service identifiers', function (string $invalid): void {
// GIVEN / WHEN / THEN
expect(fn () => new ServiceId($invalid))
->toThrow(\DomainException::class);
})->with(['SERV01', 'abc', '', ' 097 ', '-10']);
});