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

31 lines
926 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects\Inco;
use Domain\Models\ValueObjects\Inco\StorageCondition;
covers(StorageCondition::class);
describe('StorageCondition Value Object Instantiation', function (): void {
it('can be instantiated with storage instructions', function (): void {
// GIVEN
$instructions = 'À conserver entre 0°C et 4°C';
// WHEN
$storage = new StorageCondition($instructions);
// THEN
expect($storage->instructions)->toBe('À conserver entre 0°C et 4°C');
});
});
describe('StorageCondition Value Object Domain Rules', function (): void {
it('throws DomainException for empty instructions', function (): void {
// GIVEN, WHEN & THEN
expect(fn () => new StorageCondition(' '))
->toThrow(\DomainException::class, 'Invalid instructions: must not be empty');
});
});