Beispiel #1
0
 public function testContentWithSrcAndTypeToAndFromStringShouldMatch()
 {
     $this->content->src = 'http://www.example.com/image.png';
     $this->content->type = 'image/png';
     $contentXml = $this->content->saveXML();
     $newContent = new Extension\Content();
     $newContent->transferFromXML($contentXml);
     $newContentXml = $newContent->saveXML();
     $this->assertEquals($newContentXml, $contentXml);
     $this->assertEquals('http://www.example.com/image.png', $newContent->src);
     $this->assertEquals('image/png', $newContent->type);
 }
Beispiel #2
0
 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 {
     $element = parent::getDOM($doc, $majorVersion, $minorVersion);
     if ($this->_content != null) {
         $element->appendChild($this->_content->getDOM($element->ownerDocument));
     }
     if ($this->_published != null) {
         $element->appendChild($this->_published->getDOM($element->ownerDocument));
     }
     if ($this->_source != null) {
         $element->appendChild($this->_source->getDOM($element->ownerDocument));
     }
     if ($this->_summary != null) {
         $element->appendChild($this->_summary->getDOM($element->ownerDocument));
     }
     if ($this->_control != null) {
         $element->appendChild($this->_control->getDOM($element->ownerDocument));
     }
     if ($this->_edited != null) {
         $element->appendChild($this->_edited->getDOM($element->ownerDocument));
     }
     return $element;
 }
Beispiel #3
0
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('atom') . ':' . 'content':
             $content = new Extension\Content();
             $content->transferFromDOM($child);
             $this->_content = $content;
             break;
         case $this->lookupNamespace('atom') . ':' . 'published':
             $published = new Extension\Published();
             $published->transferFromDOM($child);
             $this->_published = $published;
             break;
         case $this->lookupNamespace('atom') . ':' . 'source':
             $source = new Extension\Source();
             $source->transferFromDOM($child);
             $this->_source = $source;
             break;
         case $this->lookupNamespace('atom') . ':' . 'summary':
             $summary = new Extension\Summary();
             $summary->transferFromDOM($child);
             $this->_summary = $summary;
             break;
         case $this->lookupNamespace('app') . ':' . 'control':
             $control = new Extension\Control();
             $control->transferFromDOM($child);
             $this->_control = $control;
             break;
         case $this->lookupNamespace('app') . ':' . 'edited':
             $edited = new Extension\Edited();
             $edited->transferFromDOM($child);
             $this->_edited = $edited;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }