From f8b5722a78569eed13fc50b95eea52325c35fb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Thu, 13 Aug 2026 11:57:52 +0200 Subject: [PATCH] test(ArcadiaEmployeeId): add unit tests for ArcadiaEmployeeId value object --- .../Entities}/ArcadiaEmployeeIdTest.php | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) rename tests/Unit/Domain/{ => Models/ValueObjects/Entities}/ArcadiaEmployeeIdTest.php (84%) diff --git a/tests/Unit/Domain/ArcadiaEmployeeIdTest.php b/tests/Unit/Domain/Models/ValueObjects/Entities/ArcadiaEmployeeIdTest.php similarity index 84% rename from tests/Unit/Domain/ArcadiaEmployeeIdTest.php rename to tests/Unit/Domain/Models/ValueObjects/Entities/ArcadiaEmployeeIdTest.php index eaeaa20..40ec683 100644 --- a/tests/Unit/Domain/ArcadiaEmployeeIdTest.php +++ b/tests/Unit/Domain/Models/ValueObjects/Entities/ArcadiaEmployeeIdTest.php @@ -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); + }); });