ldc-mesbr-app/tests/Unit/Domain/Models/ValueObjects/Coupon/CouponLegalInformationTest.php
2026-10-12 17:08:07 +02:00

48 lines
1.5 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects\Coupon;
use Shared\Enums\Country;
use Domain\Models\ValueObjects\Coupon\CouponLegalInformation;
covers(CouponLegalInformation::class);
describe('coupon legal information', function (): void {
$legalText = 'Lorem ipsum dolor sit amet consectetur adipiscing elit.';
$emptyLegalText = '';
$forLocale = Country::FRANCE;
it('creates a valid coupon legal information FRANCE', function () use ($legalText, $forLocale): void {
// GIVEN / WHEN
$couponLegalInformation = new CouponLegalInformation(
$legalText,
$forLocale,
);
// THEN
expect($couponLegalInformation->legalText)->toBe($legalText)
->and($couponLegalInformation->forLocale)->toBe($forLocale);
});
it('creates a valid coupon legal information BENELUX', function () use ($legalText): void {
// GIVEN / WHEN
$couponLegalInformation = new CouponLegalInformation(
$legalText,
Country::BENELUX,
);
// THEN
expect($couponLegalInformation->legalText)->toBe($legalText)
->and($couponLegalInformation->forLocale)->toBe(Country::BENELUX);
});
it('rejects invalid coupon legal information', function () use ($emptyLegalText, $forLocale): void {
// GIVEN / WHEN / THEN
expect(fn (): CouponLegalInformation => new CouponLegalInformation(
$emptyLegalText,
$forLocale,
))->toThrow(\DomainException::class);
});
});