30 lines
926 B
PHP
30 lines
926 B
PHP
<?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');
|
|
});
|
|
});
|