public function testWriteAndRead() { $stream = new Context($this->_testConfig); $this->assertTrue(is_resource($stream->open())); $this->assertTrue(is_resource($stream->resource())); $response = $stream->send(new Request(), array('response' => 'lithium\\net\\http\\Response')); $this->assertTrue($response instanceof Response); $this->assertEqual(trim(file_get_contents($this->_testUrl)), trim($response->body())); $this->assertTrue($stream->eof()); }
public function testSendWithObject() { $stream = new Context($this->_testConfig); $this->assertTrue(is_resource($stream->open())); $result = $stream->send(new Request($this->_testConfig), array('response' => 'lithium\\net\\http\\Response')); $this->assertTrue($result instanceof Response); $this->assertPattern("/^HTTP/", (string) $result); $this->assertTrue($stream->eof()); }