public function testGetInfo()
 {
     $url = 'http://google.com';
     $response_body = "Hello World";
     $this->setupRequest($url, $response_body);
     $this->response->setExternalBytesSent(111);
     $this->response->setExternalBytesReceived(222);
     $this->response->setFinalUrl('http://lotr.com');
     $this->addResponseHeader('Content-Type', 'text/html');
     $this->apiProxyMock->expectCall('urlfetch', 'Fetch', $this->request, $this->response);
     $curl_lite = new CurlLite();
     $curl_lite->setOptionsArray([CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true]);
     $result = $curl_lite->exec();
     $this->assertEquals($response_body, $result);
     $this->assertEquals(200, $curl_lite->getInfo(CURLINFO_HTTP_CODE));
     $this->assertEquals('http://lotr.com', $curl_lite->getInfo(CURLINFO_EFFECTIVE_URL));
     $this->assertEquals('text/html', $curl_lite->getInfo(CURLINFO_CONTENT_TYPE));
     $this->assertEquals(111, $curl_lite->getInfo(CURLINFO_SIZE_UPLOAD));
     $this->assertEquals(222, $curl_lite->getInfo(CURLINFO_SIZE_DOWNLOAD));
     $this->assertEquals(1, $curl_lite->getInfo(CURLINFO_REDIRECT_COUNT));
     $this->apiProxyMock->verify();
 }
Beispiel #2
0
 function curl_strerror($errornum)
 {
     return CurlLite::strerror($errornum);
 }