protected function XMLRPCBasicTestCase::testListMethods

7.x xmlrpc.test protected XMLRPCBasicTestCase::testListMethods()

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

File

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