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

48 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects;
use Domain\Models\ValueObjects\PrintRules;
covers(PrintRules::class);
describe('print rules', function (): void {
it('creates print rules with both fields set', function (): void {
// WHEN
$printRules = new PrintRules(maxPerCustomer: 3, cooldownDays: 30);
// THEN
expect($printRules)->toBeInstanceOf(PrintRules::class)
->and($printRules->maxPerCustomer)->toBe(3)
->and($printRules->cooldownDays)->toBe(30);
});
it('creates print rules with only maxPerCustomer set', function (): void {
// WHEN
$printRules = new PrintRules(maxPerCustomer: 5);
// THEN
expect($printRules->maxPerCustomer)->toBe(5)
->and($printRules->cooldownDays)->toBeNull();
});
it('creates print rules with only cooldownDays set', function (): void {
// WHEN
$printRules = new PrintRules(cooldownDays: 45);
// THEN
expect($printRules->maxPerCustomer)->toBeNull()
->and($printRules->cooldownDays)->toBe(45);
});
it('creates print rules with both fields null by default', function (): void {
// WHEN
$printRules = new PrintRules();
// THEN
expect($printRules->maxPerCustomer)->toBeNull()
->and($printRules->cooldownDays)->toBeNull();
});
});