ldc-mesbr-app/tests/Unit/Domain/Models/ValueObjects/Coupon/CouponLegalInformationTest.php

49 lines
1.5 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects\Coupon;
2026-09-25 16:21:20 +02:00
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);
});
});