示例#1
0
 /**
  * Invokes the XML-RPC Client
  *
  * @param string $method
  * @param array  $params
  *
  * @return mixed
  */
 protected function call($method, array $params = [])
 {
     $params['password'] = $this->password;
     try {
         return $this->xmlrpcClient->call('grav.' . $method, $params);
     } catch (ResponseException $e) {
         throw Exception\Fault::create($e->getFaultString(), $e->getFaultCode());
     }
 }
 /** @dataProvider getClients */
 public function testFault(CallClientInterface $client)
 {
     try {
         $client->call('system.fault');
         $this->fail('Expected exception');
     } catch (fXmlRpc\Exception\ResponseException $e) {
         $this->assertContains('ERROR', $e->getMessage());
         $this->assertContains('ERROR', $e->getFaultString());
         $this->assertSame(0, $e->getCode());
         $this->assertSame(123, $e->getFaultCode());
     }
 }
示例#3
0
 function it_throws_a_generic_fault_exception_when_something_went_bad_and_we_do_not_know_it(CallClientInterface $client)
 {
     $client->call(Argument::type('string'), Argument::type('array'))->willThrow('fXmlRpc\\Exception\\ResponseException');
     $this->shouldThrow('Gravatar\\Xmlrpc\\Exception\\Fault')->duringTest([]);
 }