XMLRPCBasicTestCase::testListMethods

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

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

File

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

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');
}
Login or register to post comments