test(Employee): add unit tests for Employee entity
This commit is contained in:
parent
31b83970b5
commit
90d7bfdf37
1 changed files with 41 additions and 0 deletions
41
tests/Unit/Domain/Entities/EmployeeTest.php
Normal file
41
tests/Unit/Domain/Entities/EmployeeTest.php
Normal 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');
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue