Beispiel #1
0
 function setUp()
 {
     $this->sync = REST_Client::factory('sync', array('verbose' => false));
     $this->async = REST_Client::factory('async', array('verbose' => false));
     if (getenv('http_proxy')) {
         $this->http_proxy = getenv('http_proxy');
     }
 }
Beispiel #2
0
 function test_hook_modify()
 {
     $this->hook_flags = array();
     $rest = REST_Client::factory('async', array('verbose' => false))->addFireHook(array($this, 'fire_hook_modify'))->addFetchHook(array($this, 'fetch_hook_modify'));
     $r = REST_Request::newInstance()->setProtocol('http')->setHost($this->test_host)->setPort($this->test_port);
     $rest->fire($r->get('/'));
     $resp = $rest->fetch();
     $this->assertEquals('/mymodifiedurl', $r->getUrl());
     $this->assertEquals(404, $resp->code);
 }
Beispiel #3
0
 public function __construct($host = 'localhost', $port = 80, $options = array())
 {
     $this->request = REST_Request::newInstance()->setProtocol('http')->setHost($host)->setPort($port)->setCurlOptions($options);
     $this->client = REST_Client::factory('sync', array('verbose' => false));
 }