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

31 lines
809 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects;
use Domain\Models\ValueObjects\BrandCode;
covers(BrandCode::class);
describe('BrandCode Value Object Instantiation', function (): void {
it('accepts valid positive brand codes', function (int $input): void {
// GIVEN
$value = $input;
// WHEN
$brandCode = new BrandCode($value);
// THEN
expect($brandCode->value)->toBe($value);
})->with([13, 1, 9999]);
});
describe('BrandCode Value Object Domain Rules', function (): void {
it('rejects zero or negative brand codes', function (int $invalid): void {
// GIVEN / WHEN / THEN
expect(fn () => new BrandCode($invalid))
->toThrow(\DomainException::class);
})->with([0, -1, -9999]);
});