34 lines
940 B
PHP
34 lines
940 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Models\ValueObjects\CampaignRequest;
|
|
|
|
use Domain\Models\ValueObjects\CampaignRequest\RejectionReason;
|
|
|
|
covers(RejectionReason::class);
|
|
|
|
describe('rejection reason', function (): void {
|
|
it('creates a valid rejection reason', function (): void {
|
|
// GIVEN
|
|
$value = 'Missing legal documents.';
|
|
|
|
// WHEN
|
|
$reason = new RejectionReason($value);
|
|
|
|
// THEN
|
|
expect($reason)->toBeInstanceOf(RejectionReason::class)
|
|
->and($reason->value)->toBe($value);
|
|
});
|
|
|
|
it('rejects an empty or whitespace-only reason', function (string $value): void {
|
|
// WHEN
|
|
$action = fn (): RejectionReason => new RejectionReason($value);
|
|
|
|
// THEN
|
|
expect($action)->toThrow(\DomainException::class, 'Rejection reason cannot be empty.');
|
|
})->with([
|
|
'empty' => '',
|
|
'spaces' => ' ',
|
|
]);
|
|
});
|