$c) { $d = $b[$key]; if (!match($c, $d)) { $matches = false; break; } } } else { if ($a !== $b || xmlrpc_get_type($a) !== xmlrpc_get_type($b)) { $matches = false; } } return $matches; } function pass($method) { echo "pass $method()
"; } function fail($method, $sent, $received) { echo "fail $method()
"; if ($sent) { echo "

sent

"; var_dump($sent); echo ""; } if ($received) { echo "

received

"; var_dump($received); echo ""; } } function check_if_matches($method, $sent, $received) { if (match($sent, $received)) { pass($method); } else { fail($method, $sent, $received); } } function foo($method_name, $args) { xmlrpc_encode_request($method_name, $args); } function run_test($server, $debug, $output, $method, $args) { global $HTTP_GET_VARS; echo "
"; $params = array($args); if (!empty($HTTP_GET_VARS['start_debug'])) // zend ide support $server['uri'] .= "?start_debug=1"; $result = xu_rpc_http_concise(array('method' => $method, 'args' => $params, 'host' => $server['host'], 'uri' => $server['uri'], 'port' => $server['port'], 'debug' => $debug, 'output' => $output)); check_if_matches($method, $args, $result); echo ""; flush(); } function run_no_param_test($server, $debug, $output, $method) { global $HTTP_GET_VARS; echo "
"; if (!empty($HTTP_GET_VARS['start_debug'])) // zend ide support $server['uri'] .= "?start_debug=1"; $result = xu_rpc_http_concise(array('method' => $method, 'host' => $server['host'], 'uri' => $server['uri'], 'port' => $server['port'], 'debug' => $debug, 'output' => $output)); if ($result && gettype($result) === "integer") { pass($method); } else { fail($method, false, $result); } flush(); } // a method to run wiki tests against remote server. tests described at bottom. function run_easy_tests($server, $debug=0, $output = null) { global $wiki_dmap; run_no_param_test($server, $debug, $output, "wiki.getRPCVersionSupported"); // of the last day: run_test($server, $debug, $output, "wiki.getRecentChanges", iso8601_encode(time()-86400, 1)); /* ... */ } function run_stress_tests($server, $debug=0, $output=null) { global $wiki_dmap; run_no_param_test($server, $debug, $output, "wiki.getRPCVersionSupported"); // of the last day: run_test($server, $debug, $output, "wiki.getRecentChanges", iso8601_encode(time()-86400, 1)); /* ... */ } // a method to display an html form for invoking the script function print_html_form($servers_list) { echo <<< END

Choose an xmlrpc wiki server to run tests against

END; print_servers_form($servers_list); } // some code which determines if we are in form display or response mode. $server_list = get_wiki_servers(); $server = get_server_from_user($server_list); if ($server) { $debug = $GLOBALS['HTTP_GET_VARS']['debug'] || $GLOBALS['HTTP_GET_VARS']['start_debug']; $output['version'] = $GLOBALS['HTTP_GET_VARS']['version']; if ($server) { $title = $server['title']; echo "

Results for $title

"; if($GLOBALS['HTTP_GET_VARS']['stress'] == 1) { run_stress_tests($server, $debug, $output); } else { run_easy_tests($server, $debug, $output); } } else { echo "

invalid option

"; } } else { print_html_form($server_list); }