예제 #1
0
 /**
  * Test POST request.with empty body
  *
  * @return void
  */
 public function testSendPostRequestEmptyBody()
 {
     $service = new Service();
     $adapter = $this->getMock('Zend\\Http\\Client\\Adapter\\Test', array('write'));
     $adapter->expects($this->once())->method('write')->with($this->equalTo('POST'), $this->equalTo(new \Zend\Uri\Http('http://example.tld')));
     $service->setDefaultAdapter($adapter);
     $service->post('http://example.tld');
 }
예제 #2
0
 /**
  * Test proxify with a Curl adapter.
  *
  * @return void
  */
 public function testProxifyCurlAdapter()
 {
     $service = new Service(array('proxy_host' => 'localhost', 'proxy_port' => '666'));
     $service->setDefaultAdapter(new \Zend\Http\Client\Adapter\Curl());
     $client = new \Zend\Http\Client('http://example.tld:8080');
     $client = $service->proxify($client);
     $adapter = $client->getAdapter();
     $this->assertInstanceOf('Zend\\Http\\Client\\Adapter\\Curl', $adapter);
     $config = $adapter->getConfig();
     $this->assertEquals('localhost', $config['curloptions'][CURLOPT_PROXY]);
     $this->assertEquals('666', $config['curloptions'][CURLOPT_PROXYPORT]);
 }