value)->toBe($value); })->with([ hash('sha256', ''), hash('sha256', 'payload content'), str_repeat('a', 64), str_repeat('F', 64), ]); }); describe('HttpBodyHash Value Object Validation Rules', function (): void { it('throws InvalidArgumentException when given an empty body hash', function (): void { // GIVEN $invalid = ''; // WHEN $execution = fn () => new HttpBodyHash($invalid); // THEN expect($execution)->toThrow( \InvalidArgumentException::class, 'HttpBody cannot be empty' ); }); it('throws InvalidArgumentException when given an invalid SHA256 hash', function (string $invalid): void { // GIVEN $input = $invalid; // WHEN $execution = fn () => new HttpBodyHash($input); // THEN expect($execution)->toThrow( \InvalidArgumentException::class, 'HttpBody must be a valid SHA256 hash' ); })->with([ 'invalid_hash', '12345', str_repeat('g', 64), // Invalid hex character str_repeat('a', 63), // 63 chars (too short) str_repeat('a', 65), // 65 chars (too long) ]); });