36 lines
793 B
PHP
36 lines
793 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Shared\DDD\Models;
|
|
|
|
use Shared\DDD\Models\EntityId;
|
|
|
|
covers(EntityId::class);
|
|
|
|
describe('entity id', function (): void {
|
|
it('should create an entity id', function (): void {
|
|
// GIVEN / WHEN
|
|
$id = new DummyEntityId('123');
|
|
|
|
// THEN
|
|
expect($id->value)->toBe('123');
|
|
});
|
|
|
|
it('can be casted to string', function (): void {
|
|
// GIVEN / WHEN
|
|
$id = new DummyEntityId('123');
|
|
|
|
// THEN
|
|
expect((string) $id)->toBe('123');
|
|
});
|
|
|
|
it('can be compared for equality', function (): void {
|
|
// GIVEN / WHEN
|
|
$id1 = new DummyEntityId('123');
|
|
$id2 = new DummyEntityId('123');
|
|
|
|
// THEN
|
|
expect($id1->equals($id2))->toBeTrue();
|
|
});
|
|
});
|