public function testImportUrlSetsNullVersionIfNoVersionHeaderOnFeed() { $this->adapter->setResponse($this->httpFeedSampleWithoutVersion); $feed = $this->service->getFeed('http://www.example.com'); $this->assertEquals(null, $feed->getMajorProtocolVersion()); $this->assertEquals(null, $feed->getMinorProtocolVersion()); foreach ($feed as $entry) { $this->assertEquals(null, $entry->getMajorProtocolVersion()); $this->assertEquals(null, $entry->getMinorProtocolVersion()); } }
public function testReloadInheritsClassname() { $className = '\\ZendGData\\Entry'; $etag = Etag::fromString('Etag: ABCD1234'); $this->service->setMajorProtocolVersion(2); $this->adapter->setResponse($this->httpEntrySample); $entry = new $className(); $entry->setService($this->service); $entry->link = array(new Extension\Link('http://www.example.com', 'edit', 'application/atom+xml')); $entry->setEtag($etag); $newEntry = $entry->reload(); $this->assertEquals('ZendGData\\Entry', get_class($newEntry)); }
/** * Separating this from send method allows subclasses to wrap * the interaction with the adapter * * @param Http $uri * @param string $method * @param bool $secure * @param array $headers * @param string $body * @return string the raw response * @throws Exception\RuntimeException */ protected function doRequest(Http $uri, $method, $secure = false, $headers = array(), $body = '') { // Open the connection, send the request and read the response $this->adapter->connect($uri->getHost(), $uri->getPort(), $secure); if ($this->config['outputstream']) { if ($this->adapter instanceof Client\Adapter\StreamInterface) { $stream = $this->openTempStream(); $this->adapter->setOutputStream($stream); } else { throw new Exception\RuntimeException('Adapter does not support streaming'); } } // HTTP connection $this->lastRawRequest = $this->adapter->write($method, $uri, $this->config['httpversion'], $headers, $body); return $this->adapter->read(); }
public function setServerResponseTo($nativeVars) { $response = $this->getServerResponseFor($nativeVars); $this->httpAdapter->setResponse($response); }