ldc-arcadia-api/tests/Unit/Domain/Models/ValueObjects/IncoSheets/IncoWeightTest.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

34 lines
994 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects\IncoSheets;
use Domain\Models\ValueObjects\IncoSheets\IncoWeight;
covers(IncoWeight::class);
describe('IncoWeight Value Object Instantiation', function (): void {
it('can be instantiated with valid weight numbers', function (): void {
// GIVEN
$net = 1000;
$gross = 1200;
$avg = 1100;
// WHEN
$weight = new IncoWeight($net, $gross, $avg);
// THEN
expect($weight->netWeight)->toBe(1000)
->and($weight->grossWeight)->toBe(1200)
->and($weight->theoreticalAverage)->toBe(1100);
});
});
describe('IncoWeight Value Object Domain Rules', function (): void {
it('throws DomainException for negative weight', function (): void {
// GIVEN, WHEN & THEN
expect(fn () => new IncoWeight(-1, 100, 100))
->toThrow(\DomainException::class, 'Weight values must be non-negative.');
});
});