ldc-boutique-cnc-sable/tests/Unit/Domain/Models/ValueObjects/EmailTest.php
2026-10-27 09:58:12 +01:00

31 lines
644 B
PHP

<?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);
});
});