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

38 lines
1.2 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 {
beforeEach(function (): void {
$this->legalText = 'Lorem ipsum dolor sit amet consectetur adipiscing elit.';
$this->emptyLegalText = '';
$this->forLocale = Country::FRANCE;
});
it('creates a valid coupon legal information', function (): void {
// GIVEN / WHEN
$couponLegalInformation = new CouponLegalInformation(
$this->legalText,
$this->forLocale
);
// THEN
expect($couponLegalInformation->legalText)->toBe($this->legalText)
->and($couponLegalInformation->forLocale)->toBe($this->forLocale);
});
it('rejects invalid coupon legal information', function (): void {
// GIVEN / WHEN / THEN
expect(fn (): CouponLegalInformation => new CouponLegalInformation(
$this->emptyLegalText,
$this->forLocale
))->toThrow(\DomainException::class);
});
});