- 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
30 lines
809 B
PHP
30 lines
809 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Models\ValueObjects;
|
|
|
|
use Domain\Models\ValueObjects\BrandCode;
|
|
|
|
covers(BrandCode::class);
|
|
|
|
describe('BrandCode Value Object Instantiation', function (): void {
|
|
it('accepts valid positive brand codes', function (int $input): void {
|
|
// GIVEN
|
|
$value = $input;
|
|
|
|
// WHEN
|
|
$brandCode = new BrandCode($value);
|
|
|
|
// THEN
|
|
expect($brandCode->value)->toBe($value);
|
|
})->with([13, 1, 9999]);
|
|
});
|
|
|
|
describe('BrandCode Value Object Domain Rules', function (): void {
|
|
it('rejects zero or negative brand codes', function (int $invalid): void {
|
|
// GIVEN / WHEN / THEN
|
|
expect(fn () => new BrandCode($invalid))
|
|
->toThrow(\DomainException::class);
|
|
})->with([0, -1, -9999]);
|
|
});
|