/**
  * Format a request
  *
  * @param string $type
  * @return string
  */
 public function getRequest($type)
 {
     $params = $this->client->getLastRequest()->getParams();
     $login_informations = null;
     if ('common' === $type) {
         $object = '';
         $method = $this->client->getLastRequest()->getMethod();
         $params[2] = '*****';
     } elseif ('object' === $type) {
         $object = $params[3];
         $method = $params[4];
         $login_informations = array($params[0], $params[1], $params[2]);
         unset($params[0], $params[1], $params[2], $params[3], $params[4]);
     } elseif ('db' === $type) {
         $object = 'db';
         $method = 'list';
         $params = array();
     } else {
         return 'Nothing...';
     }
     return static::buildRequestString($object, $method, $login_informations, $params);
 }
예제 #2
0
 public function testGettingAllMethodSignaturesDefaultsToMulticall()
 {
     // system.listMethods() will return ['foo', 'bar']
     $whatListMethodsReturns = array('foo', 'bar');
     $response = $this->getServerResponseFor($whatListMethodsReturns);
     $this->httpAdapter->setResponse($response);
     // system.multicall() will then return [fooSignatures, barSignatures]
     $fooSignatures = array(array('int'), array('int', 'string'));
     $barSignatures = array(array('boolean'));
     $whatMulticallReturns = array($fooSignatures, $barSignatures);
     $response = $this->getServerResponseFor($whatMulticallReturns);
     $this->httpAdapter->addResponse($response);
     $i = $this->xmlrpcClient->getIntrospector();
     $expected = array('foo' => $fooSignatures, 'bar' => $barSignatures);
     $this->assertEquals($expected, $i->getSignatureForEachMethod());
     $request = $this->xmlrpcClient->getLastRequest();
     $this->assertEquals('system.multicall', $request->getMethod());
 }