41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Unit\Domain\Entities;
|
|
|
|
use Domain\Models\Entities\Employee;
|
|
use Domain\Models\ValueObjects\Employees\SiRhMatricule;
|
|
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 SiRhMatricule('12345678');
|
|
$now = new \DateTimeImmutable();
|
|
|
|
// WHEN
|
|
$employee = Employee::hydrate(
|
|
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');
|
|
});
|
|
});
|