You are here

public function XmlRpcBasicTest::testListMethods in xmlrpc 8

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

File

src/Tests/XmlRpcBasicTest.php, line 29

Class

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

Namespace

Drupal\xmlrpc\Tests

Code

public function testListMethods() {

  // Minimum list of methods that should be included.
  $minimum = [
    'system.multicall',
    'system.methodSignature',
    'system.getCapabilities',
    'system.listMethods',
    'system.methodHelp',
  ];

  // Invoke XML-RPC call to get list of methods.
  $methods = $this
    ->xmlRpcGet([
    'system.listMethods' => [],
  ]);

  // Ensure that the minimum methods were found.
  $count = 0;
  foreach ((array) $methods as $method) {
    if (in_array($method, $minimum)) {
      $count++;
    }
  }
  $this
    ->assertEqual($count, count($minimum), 'system.listMethods returned at least the minimum listing');
}