public function test_getLastErrorMessage() { $this->curl->setOption(CURLOPT_URL, 'foo://bar'); $this->curl->setOption(CURLOPT_RETURNTRANSFER, TRUE); $this->curl->execute(); $this->assertEquals($this->curl->getLastErrorMessage(), 'cURL failed with error #1: Protocol foo not supported or disabled in libcurl'); }
/** * Fetches data from the Blizzard Diablo 3 API * * @param string $url * @return mixed */ protected function getData($url) { // set curl options $this->request = new CurlRequest($url); $this->request->setOption(CURLOPT_URL, $url); $this->request->setOption(CURLOPT_RETURNTRANSFER, true); $this->request->setOption(CURLOPT_CONNECTTIMEOUT, 5); $this->request->setOption(CURLOPT_TIMEOUT, 30); $this->request->setOption(CURLOPT_MAXREDIRS, 7); $this->request->setOption(CURLOPT_HEADER, false); return $this->request->execute(); }