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

38 lines
892 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 {
beforeEach(function (): void {
$this->value = '1010100101';
$this->emptyValue = '';
$this->format = BarcodeFormat::EAN13;
});
it('creates a valid gs1', function (): void {
// WHEN
$GS1 = new GS1(
$this->value,
$this->format
);
// THEN
expect($GS1->value)->toBe($this->value)
->and($GS1->format)->toBe($this->format);
});
it('rejects invalid gs1', function (): void {
// GIVEN / WHEN / THEN
expect(fn (): GS1 => new GS1(
$this->emptyValue,
$this->format
))->toThrow(\DomainException::class);
});
});