/** * @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()); } }
/** * @dataProvider getClients */ public function testServerReturnsInvalidResult(ClientInterface $client) { $client->setUri(static::$errorEndpoint); try { $client->call('system.failure'); $this->fail('Exception expected'); } catch (\fXmlRpc\Exception\HttpException $e) { $this->assertInstanceOf('fXmlRpc\\Exception\\TransportException', $e); $this->assertInstanceOf('fXmlRpc\\Exception\\ExceptionInterface', $e); $this->assertInstanceOf('RuntimeException', $e); $this->assertStringStartsWith('An HTTP error occurred', $e->getMessage()); $this->assertSame(500, $e->getCode()); } }