value)->toBe($value); })->with([ 'arcadia_sec_' . str_repeat('b', 86), str_repeat('s', 86), str_repeat('s', 98), str_repeat('s', 120), ]); }); describe('ClientSecret Value Object Validation Rules', function (): void { it('throws InvalidArgumentException when given an empty or whitespace-only client secret', function (string $invalid): void { // GIVEN $input = $invalid; // WHEN $execution = fn () => new ClientSecret($input); // THEN expect($execution)->toThrow( \InvalidArgumentException::class, 'ClientSecret cannot be empty.' ); })->with(['', ' ']); it('throws InvalidArgumentException when client secret contains invalid characters', function (string $invalid): void { // GIVEN $input = $invalid; // WHEN $execution = fn () => new ClientSecret($input); // THEN expect($execution)->toThrow( \InvalidArgumentException::class, 'ClientSecret can only contain alphanumeric characters, dashes, and underscores.' ); })->with([ 'arcadia_sec_invalid_chars_@!' . str_repeat('a', 60), 'arcadia_sec with spaces in between' . str_repeat('a', 60), ]); it('throws InvalidArgumentException when client secret has an invalid length', function (string $invalid): void { // GIVEN $input = $invalid; // WHEN $execution = fn () => new ClientSecret($input); // THEN expect($execution)->toThrow( \InvalidArgumentException::class, 'ClientSecret must be between 86 and 120 characters long.' ); })->with([ str_repeat('a', 85), str_repeat('a', 121), ]); });