ldc-boutique-cnc-sable/tests/Unit/Domain/Models/ValueObjects/EmailTest.php

32 lines
644 B
PHP
Raw Permalink Normal View History

2026-06-14 21:32:07 +02:00
<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Models\ValueObjects;
use Domain\Models\ValueObjects\Email;
describe('Email', function () {
it('can instantiate', function () {
// GIVEN
$email = 'test@example.com';
// WHEN
$vo = new Email($email);
// THEN
expect($vo)->toBeInstanceOf(Email::class);
});
it('throws exception if email format is invalid', function () {
// GIVEN
$email = 'not-an-email';
// WHEN
$action = fn () => new Email($email);
// THEN
expect($action)->toThrow(\DomainException::class);
});
});