test(ArcadiaEmployeeId): add unit tests for ArcadiaEmployeeId value object
This commit is contained in:
parent
0111ee2ac4
commit
f8b5722a78
1 changed files with 20 additions and 9 deletions
|
|
@ -33,15 +33,6 @@ describe('ArcadiaEmployeeId Value Object', function (): void {
|
|||
->and((string) $employeeId)->toBe('01155902');
|
||||
});
|
||||
|
||||
it('throws a DomainException when given an invalid matricule pattern', function (): void {
|
||||
// GIVEN
|
||||
$invalidMatricule = '12345';
|
||||
|
||||
// WHEN & THEN
|
||||
expect(fn () => new ArcadiaEmployeeId($invalidMatricule))
|
||||
->toThrow(\DomainException::class);
|
||||
});
|
||||
|
||||
it('supports equality check with another ArcadiaEmployeeId instance', function (): void {
|
||||
// GIVEN
|
||||
$firstId = new ArcadiaEmployeeId('01155902');
|
||||
|
|
@ -54,4 +45,24 @@ describe('ArcadiaEmployeeId Value Object', function (): void {
|
|||
->and($firstId->equals($differentId))
|
||||
->toBeFalse();
|
||||
});
|
||||
|
||||
it('can be converted to a string representation', function (): void {
|
||||
// GIVEN
|
||||
$employeeId = new ArcadiaEmployeeId('01155902');
|
||||
|
||||
// WHEN
|
||||
$stringRepresentation = (string) $employeeId;
|
||||
|
||||
// THEN
|
||||
expect($stringRepresentation)->toBe('01155902');
|
||||
});
|
||||
|
||||
it('throws a DomainException when given an invalid matricule pattern', function (): void {
|
||||
// GIVEN
|
||||
$invalidMatricule = '12345';
|
||||
|
||||
// WHEN & THEN
|
||||
expect(fn () => new ArcadiaEmployeeId($invalidMatricule))
|
||||
->toThrow(\DomainException::class);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue