Ejemplo n.º 1
0
 public function testGetResponse()
 {
     $curl = new Curl(array('proxy_host' => false));
     $curl->exec(sprintf('http://localhost:%d/curl.txt', WEBSERVER_PORT));
     $this->assertSame('OK', $curl->getResponseStatusMessage());
     $this->assertEquals(145 + self::$websererPortLength, strlen($curl->getResponse()));
     $curl->exec(sprintf('http://localhost:%d/404.txt', WEBSERVER_PORT));
     $this->assertSame('Not Found', $curl->getResponseStatusMessage());
 }
Ejemplo n.º 2
0
 public function testGetResponseStatusMessage()
 {
     $this->startPhpWebserver();
     $curl = new Curl();
     $curl->exec('http://localhost:8000/curl.txt');
     $this->assertEquals('OK', $curl->getResponseStatusMessage());
     $curl->exec('http://localhost:8000/404.txt');
     $this->assertEquals('Not Found', $curl->getResponseStatusMessage());
     $this->stopPhpWebserver();
 }