value)->toBe('12345'); }); it('can be instantiated with a string of digits prefixed with %', function (): void { // GIVEN $validValue = '%12345'; // WHEN $incoIdQuery = new IncoIdQuery($validValue); // THEN expect($incoIdQuery->value)->toBe('%12345'); }); it('can be instantiated with a string of digits suffixed with %', function (): void { // GIVEN $validValue = '12345%'; // WHEN $incoIdQuery = new IncoIdQuery($validValue); // THEN expect($incoIdQuery->value)->toBe('12345%'); }); it('can be instantiated with a string of digits prefixed and suffixed with %', function (): void { // GIVEN $validValue = '%12345%'; // WHEN $incoIdQuery = new IncoIdQuery($validValue); // THEN expect($incoIdQuery->value)->toBe('%12345%'); }); it('can be instantiated with wildcards anywhere in the digit string', function (): void { // GIVEN $validValue = '%12%345%'; // WHEN $incoIdQuery = new IncoIdQuery($validValue); // THEN expect($incoIdQuery->value)->toBe('%12%345%'); }); }); describe('IncoIdQuery Value Object Domain Rules', function (): void { it('throws DomainException when instantiated with an empty string', function (): void { // GIVEN $invalidValue = ''; // WHEN & THEN expect(fn () => new IncoIdQuery($invalidValue)) ->toThrow(\DomainException::class, 'value cannot be empty'); }); it('throws DomainException when instantiated with a non-digit string', function (): void { // GIVEN $invalidValue = 'abc123'; // WHEN & THEN expect(fn () => new IncoIdQuery($invalidValue)) ->toThrow(\DomainException::class, 'value must be a string of digits optionally prefixed and/or suffixed with a % sign'); }); });