setUri() public méthode

Set the endpoint URI
public setUri ( string $uri )
$uri string
 /**
  * @param ClientInterface $client
  * @param string $url
  */
 public function __construct(ClientInterface $client, $url)
 {
     $this->client = $client;
     if ($client instanceof Client) {
         $this->client->setUri($url);
     }
 }
Exemple #2
0
 /**
  * Set the XML-RPC url
  *
  * @param string $url
  * @throws InvalidArgumentException
  */
 public function setUrl($url = null)
 {
     if ($url === NULL) {
         throw new InvalidArgumentException('URL is not valid');
     }
     $this->url = $url;
     $this->blog->setUri($this->url);
 }
 /** @dataProvider getClientsOnly */
 public function testServerNotReachableViaTcpIp(Client $client)
 {
     $client->setUri('http://127.0.0.1:12345/');
     try {
         $client->call('system.failure');
         $this->fail('Exception expected');
     } catch (\fXmlRpc\Exception\TransportException $e) {
         $this->assertInstanceOf('fXmlRpc\\Exception\\TransportException', $e);
         $this->assertInstanceOf('fXmlRpc\\Exception\\ExceptionInterface', $e);
         $this->assertInstanceOf('RuntimeException', $e);
         $this->assertStringStartsWith('Transport error occurred:', $e->getMessage());
         $this->assertSame(0, $e->getCode());
     }
 }
 public function testInvalidUri()
 {
     $this->setExpectedException('fXmlRpc\\Exception\\InvalidArgumentException', 'Expected parameter 0 to be of type "string", "object" of type "stdClass" given');
     $this->client->setUri(new \stdClass());
 }
 protected function executeSystemFailureTest(Client $client)
 {
     $client->setUri(static::$errorEndpoint);
     try {
         $client->call('system.failure');
         $this->fail('Exception expected');
     } catch (\fXmlRpc\Exception\HttpException $e) {
         $this->assertInstanceOf('fXmlRpc\\Exception\\AbstractTransportException', $e);
         $this->assertInstanceOf('fXmlRpc\\Exception\\ExceptionInterface', $e);
         $this->assertInstanceOf('RuntimeException', $e);
         $this->assertStringStartsWith('An HTTP error occurred', $e->getMessage());
         $this->assertSame(500, $e->getCode());
     }
 }