test(Employee): add unit tests for Employee entity

This commit is contained in:
Jérémy Munsch 2026-08-13 12:03:09 +02:00
parent 31b83970b5
commit 90d7bfdf37
Signed by: forge-joniko
GPG key ID: D7EFE2F5CB6CC0E4

View file

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Tests\Unit\Domain\Entities;
use Domain\Models\Entities\Employee;
use Domain\Models\ValueObjects\Entities\ArcadiaEmployeeId;
use Domain\Models\ValueObjects\EstablishmentCode;
use Domain\Models\ValueObjects\ServiceId;
use Domain\Models\ValueObjects\SiteId;
covers(Employee::class);
describe('Employee Entity', function (): void {
it('can be instantiated and exposes its id', function (): void {
// GIVEN
$id = new ArcadiaEmployeeId('12345678');
$now = new \DateTimeImmutable();
// WHEN
$employee = new Employee(
publicEmployeeNumber: $id,
lastName: 'Dupont',
firstName: 'Jean',
startDate: $now,
endDate: null,
plannedEndDate: null,
establishment: new EstablishmentCode('EST01'),
site: new SiteId('SITE'),
service: new ServiceId('097'),
createdAt: $now,
updatedAt: null,
);
// THEN
expect($employee->id())->toBe($id)
->and($employee->lastName)->toBe('Dupont')
->and($employee->firstName)->toBe('Jean');
});
});