str_repeat('A', 191)], 'name'], [['name' => 'Acme', 'status' => 'paused'], 'status'], ]; foreach ($cases as [$input, $errorKey]) { $result = validate_client($input); if (!isset($result['errors'][$errorKey])) { throw new RuntimeException("Expected validation error for {$errorKey}"); } } $valid = validate_client(['name' => ' Acme IT ', 'status' => 'active']); if ($valid['errors'] !== [] || $valid['name'] !== 'Acme IT') { throw new RuntimeException('Expected valid client input to be normalized'); } if (!client_name_is_duplicate(' acme IT ', ['Acme IT', 'Other'])) { throw new RuntimeException('Expected duplicate client names to be detected case-insensitively'); } if (client_name_is_duplicate('New Client', ['Acme IT'])) { throw new RuntimeException('Expected unique client name to be accepted'); } printf("Client validator tests: %d passed\n", count($cases) + 2);