/** {@inheritdoc} */ public function execute() { $results = $this->client->call('system.multicall', [$this->calls]); foreach ($results as $index => $result) { $this->processResult($this->handlers[$index], $result); } return $results; }
/** * {@inheritdoc} */ public function call($namespace, $method, array $arguments = []) { try { return $this->client->call($namespace . '.' . $method, $arguments); } catch (ResponseException $e) { throw Fault::create($e->getFaultString(), $e->getFaultCode()); } }
/** * @dataProvider getClients */ public function testServerNotReachableViaTcpIp(ClientInterface $client) { $client->setUri('http://127.0.0.1:12345/'); try { $client->call('system.failure'); $this->fail('Exception expected'); } catch (\fXmlRpc\Exception\TcpException $e) { $this->assertInstanceOf('fXmlRpc\\Exception\\TransportException', $e); $this->assertInstanceOf('fXmlRpc\\Exception\\ExceptionInterface', $e); $this->assertInstanceOf('RuntimeException', $e); $this->assertStringStartsWith('A transport error occurred', $e->getMessage()); $this->assertSame(0, $e->getCode()); } }
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'); }
/** * @dataProvider getClients */ public function testHeaderCustomIsSent(ClientInterface $client, TransportInterface $transport) { if (in_array('xmlrpc_header', $this->disabledExtensions)) { $this->markTestSkipped('Missing system.header() call'); } if ($transport instanceof HttpTransportInterface) { $this->assertSame($transport, $transport->setHeader('X-Foo', 'Bar')); $this->assertSame('Bar', $client->call('system.header', ['x-foo']), 'X-Foo newly set'); $this->assertSame($transport, $transport->setHeaders(['X-Bar' => 'Foo'])); $this->assertSame('Foo', $client->call('system.header', ['x-bar']), 'X-Bar newly set'); $this->assertSame($transport, $transport->setHeader('X-Foo', 'Bar')); $this->assertSame('Bar', $client->call('system.header', ['x-foo']), 'X-Foo still set'); $this->assertSame($transport, $transport->setHeader('X-Foo', null)); $this->assertSame(null, $client->call('system.header', ['x-foo']), 'X-Foo unset'); $this->assertSame($transport, $transport->setHeaders(['X-Bar' => 'Foo'])); $this->assertSame('Foo', $client->call('system.header', ['x-bar']), 'X-Bar still set'); } }