Commit 810b8512 authored by Dries's avatar Dries

- Patch #647336 by boombatower, Morbus Iff: fixed bug with when xmlrpc() is...

- Patch #647336 by boombatower, Morbus Iff: fixed bug with when xmlrpc() is called with no function arguments. Added some extra XML-RPC tests.
parent 2bc5334a
......@@ -64,6 +64,9 @@ function xmlrpc_server($callbacks) {
if ($xmlrpc_server->message->messagetype != 'methodCall') {
xmlrpc_server_error(-32600, t('Server error. Invalid XML-RPC. Request must be a methodCall.'));
}
if (!isset($xmlrpc_server->message->params)) {
$xmlrpc_server->message->params = array();
}
xmlrpc_server_set($xmlrpc_server);
$result = xmlrpc_server_call($xmlrpc_server, $xmlrpc_server->message->methodname, $xmlrpc_server->message->params);
......
<?php
// $Id$
/**
* Perform basic XML-RPC tests that do not require addition callbacks.
*/
class XMLRPCBasicTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
'name' => 'XML-RPC basic',
'description' => 'Perform basic XML-RPC tests that do not require additional callbacks.',
'group' => 'XML-RPC',
);
}
/**
* Ensure that a basic XML-RPC call with no parameters works.
*/
protected function testListMethods() {
// Minimum list of methods that should be included.
$minimum = array(
'system.multicall',
'system.methodSignature',
'system.getCapabilities',
'system.listMethods',
'system.methodHelp',
);
// Invoke XML-RPC call to get list of methods.
$url = url(NULL, array('absolute' => TRUE)) . 'xmlrpc.php';
$methods = xmlrpc($url, 'system.listMethods');
// Ensure that the minimum methods were found.
$count = 0;
foreach ($methods as $method) {
if (in_array($method, $minimum)) {
$count++;
}
}
$this->assertEqual($count, count($minimum), 'system.listMethods returned at least the minimum listing');
}
}
class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
public static function getInfo() {
return array(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment