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

34 lines
1 KiB
PHP

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