ldc-arcadia-api/tests/Unit/Domain/Models/ValueObjects/Inco/IncoWeightTest.php

33 lines
952 B
PHP
Raw Normal View History

<?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.');
});
});