/** * Set entry identifier * * @param \DOMDocument $dom * @param \DOMElement $root * @return void */ protected function _setId(\DOMDocument $dom, \DOMElement $root) { if (!$this->getDataContainer()->getId() && !$this->getDataContainer()->getLink()) { return; } $id = $dom->createElement('guid'); $root->appendChild($id); if (!$this->getDataContainer()->getId()) { $this->getDataContainer()->setId($this->getDataContainer()->getLink()); } $text = $dom->createTextNode($this->getDataContainer()->getId()); $id->appendChild($text); if (!Uri\Url::validate($this->getDataContainer()->getId())) { $id->setAttribute('isPermaLink', 'false'); } }
public function testReloadAllowsCustomURI() { $uriOverride = 'http://www.example.org'; $etag = 'ABCD1234'; $this->service->setMajorProtocolVersion(2); $this->adapter->setResponse($this->httpEntrySample); $entry = $this->service->newEntry(); $entry->link = array(new Extension\Link('http://www.example.com', 'edit', 'application/atom+xml')); $entry->setEtag($etag); $newEntry = $entry->reload($uriOverride); $requestUri = $this->adapter->popRequest()->uri; $uriOverrideObject = new Uri\Url($uriOverride); $uriOverrideObject->setPort('80'); $this->assertEquals($uriOverrideObject, $requestUri); }