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'); } }
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); }
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)); }