예제 #1
0
 /** {@inheritdoc} */
 public function call($methodName, array $params = [])
 {
     if (!is_string($methodName)) {
         throw InvalidArgumentException::expectedParameter(0, 'string', $methodName);
     }
     $params = array_merge($this->prependParams, $params, $this->appendParams);
     $payload = $this->serializer->serialize($methodName, $params);
     $response = $this->transport->send($this->uri, $payload);
     $result = $this->parser->parse($response, $isFault);
     if ($isFault) {
         throw ResponseException::fault($result);
     }
     return $result;
 }
예제 #2
0
 function it_throws_a_known_exception_when_proper_fault_returned(ClientInterface $client)
 {
     $e = ResponseException::fault(['faultString' => 'UNKNOWN_METHOD', 'faultCode' => 1]);
     $client->call('namespace.method', [])->willThrow($e);
     $this->shouldThrow('Indigo\\Supervisor\\Exception\\Fault\\UnknownMethod')->duringCall('namespace', 'method');
 }
예제 #3
0
 function it_throws_a_fault_exception_when_something_went_bad(CallClientInterface $client)
 {
     $e = ResponseException::fault(['faultString' => '', 'faultCode' => -7]);
     $client->call(Argument::type('string'), Argument::type('array'))->willThrow($e);
     $this->shouldThrow('Gravatar\\Xmlrpc\\Exception\\Fault\\InvalidUrl')->duringTest([]);
 }