You are here

protected function XMLRPCBasicTestCase::testListMethods in Drupal 7

Ensure that a basic XML-RPC call with no parameters works.

File

modules/simpletest/tests/xmlrpc.test, line 19

Class

XMLRPCBasicTestCase
Perform basic XML-RPC tests that do not require addition callbacks.

Code

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, array(
    'system.listMethods' => array(),
  ));

  // 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');
}