public function __construct(array $options = array(), BuzzClientInterface $client = null)
 {
     $this->client = is_null($client) ? new Curl() : $client;
     $this->options = array_merge($this->options, $options);
     $this->client->setTimeout($this->options['timeout']);
     $this->client->setVerifyPeer($this->options['verify_peer']);
 }
Beispiel #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->httpHost = getenv('EZP_TEST_REST_HOST') ?: 'localhost';
     $this->httpAuth = getenv('EZP_TEST_REST_AUTH') ?: 'admin:publish';
     $this->httpClient = new \Buzz\Client\Curl();
     $this->httpClient->setVerifyPeer(false);
     $this->httpClient->setTimeout(90);
     $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false);
 }
Beispiel #3
0
 protected function setUp()
 {
     parent::setUp();
     if (!($this->httpHost = getenv('EZP_TEST_REST_HOST'))) {
         self::markTestSkipped('Set the EZP_TEST_REST_HOST (api.example.com) to your eZ Publish test instance');
     }
     if (!($this->httpAuth = getenv('EZP_TEST_REST_AUTH'))) {
         self::markTestSkipped('Set the EZP_TEST_REST_AUTH (admin:publish) to your eZ Publish test instance');
     }
     $this->httpClient = new \Buzz\Client\Curl();
     $this->httpClient->setVerifyPeer(false);
     $this->httpClient->setTimeout(90);
     $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->httpHost = getenv('EZP_TEST_REST_HOST') ?: 'localhost';
     $this->httpAuth = getenv('EZP_TEST_REST_AUTH') ?: 'admin:publish';
     list($this->loginUsername, $this->loginPassword) = explode(':', $this->httpAuth);
     $this->httpClient = new \Buzz\Client\Curl();
     $this->httpClient->setVerifyPeer(false);
     $this->httpClient->setTimeout(90);
     $this->httpClient->setOption(CURLOPT_FOLLOWLOCATION, false);
     if ($this->autoLogin) {
         $session = $this->login();
         $this->headers[] = sprintf('Cookie: %s=%s', $session->name, $session->identifier);
         $this->headers[] = sprintf('X-CSRF-Token: %s', $session->csrfToken);
     }
 }
Beispiel #5
0
 protected function call()
 {
     $this->request->setMethod($this->call->getMethod());
     $this->request->setHost($this->call->getRequestPartBase());
     $this->request->setResource($this->call->getRequestPartUri());
     $this->request->setHeaders($this->headers->getHeaders());
     if ($this->call->getFormattedBody()) {
         $this->request->setContent($this->call->getFormattedBody());
     }
     $this->client->setIgnoreErrors(true);
     $this->client->setVerifyPeer($this->configuration->getVerifyPeer());
     $this->client->setMaxRedirects(0);
     $this->client->setTimeout(60);
     $this->client->send($this->request, $this->response);
 }
Beispiel #6
0
 /**
  * @param ClientInterface $client
  */
 public function setClient($client)
 {
     $this->client = $client;
     $this->client->setTimeout($this->options['timeout']);
     $this->client->setVerifyPeer(0);
 }