ldc-mesbr-app/tests/Unit/Domain/Models/ValueObjects/GS1Test.php
2026-10-02 12:47:27 +02:00

34 lines
778 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects;
use Domain\Enums\BarcodeFormat;
use Domain\Models\ValueObjects\GS1;
covers(GS1::class);
describe('gs1', function (): void {
it('creates a valid gs1', function (): void {
// GIVEN
$value = '1010100101';
$format = BarcodeFormat::EAN13;
// WHEN
$GS1 = new GS1($value, $format);
// THEN
expect($GS1->value)->toBe($value)
->and($GS1->format)->toBe($format);
});
it('rejects invalid gs1', function (): void {
// GIVEN
$value = '';
$format = BarcodeFormat::EAN13;
// GIVEN / THEN
expect(fn (): GS1 => new GS1($value, $format))->toThrow(\DomainException::class);
});
});