- 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
32 lines
952 B
PHP
32 lines
952 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 Unit Tests', function (): void {
|
|
it('instantiates valid IncoWeight with non-negative values', function (): void {
|
|
// GIVEN
|
|
$net = 100;
|
|
$gross = 120;
|
|
$average = 110;
|
|
|
|
// WHEN
|
|
$weight = new IncoWeight($net, $gross, $average);
|
|
|
|
// THEN
|
|
expect($weight->netWeight)->toBe(100)
|
|
->and($weight->grossWeight)->toBe(120)
|
|
->and($weight->theoreticalAverage)->toBe(110);
|
|
});
|
|
|
|
it('throws DomainException when instantiated with a negative weight', function (): void {
|
|
// GIVEN, WHEN & THEN
|
|
expect(fn () => new IncoWeight(-5, 100, 100))
|
|
->toThrow(\DomainException::class, 'Weight values must be non-negative.');
|
|
});
|
|
});
|