33 lines
766 B
PHP
33 lines
766 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Models\ValueObjects;
|
|
|
|
use Domain\Models\ValueObjects\CouponName;
|
|
|
|
covers(CouponName::class);
|
|
|
|
describe('coupon name', function (): void {
|
|
beforeEach(function (): void {
|
|
$this->value = 'Name';
|
|
$this->emptyValue = '';
|
|
});
|
|
|
|
it('creates a valid coupon name', function (): void {
|
|
// GIVEN / WHEN
|
|
$name = new CouponName(
|
|
$this->value
|
|
);
|
|
|
|
// THEN
|
|
expect($name->value)->toBe($this->value);
|
|
});
|
|
|
|
it('rejects invalid coupon name', function (): void {
|
|
// GIVEN / WHEN / THEN
|
|
expect(fn (): CouponName => new CouponName(
|
|
$this->emptyValue
|
|
))->toThrow(\DomainException::class);
|
|
});
|
|
});
|