Example #1
0
 public function testWriteAndRead()
 {
     $stream = new Curl($this->_testConfig);
     $this->assertTrue(is_resource($stream->open()));
     $this->assertTrue(is_resource($stream->resource()));
     $this->assertEqual(1, $stream->write());
     $this->assertPattern("/^HTTP/", (string) $stream->read());
 }
Example #2
0
 public function testWriteAndRead()
 {
     $stream = new Curl($this->_testConfig);
     $this->assertTrue(is_resource($stream->open()));
     $this->assertTrue(is_resource($stream->resource()));
     $stream->set(CURLOPT_URL, $this->_testUrl);
     $this->assertTrue($stream->write(null));
     $this->assertTrue($stream->read());
     $response = $stream->send(new Request(), array('response' => 'lithium\\net\\http\\Response'));
     $this->assertEqual(trim(file_get_contents($this->_testUrl)), trim($response->body()));
     $this->assertNull($stream->eof());
 }