Пример #1
0
 public function testExtensionAttributes()
 {
     $extensionAttributes = $this->author->extensionAttributes;
     $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar');
     $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab');
     $this->author->extensionAttributes = $extensionAttributes;
     $this->assertEquals('bar', $this->author->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $this->author->extensionAttributes['foo2']['value']);
     $authorXml = $this->author->saveXML();
     $newAuthor = new Extension\Author();
     $newAuthor->transferFromXML($authorXml);
     //var_dump($this->author);
     //print $authorXml;
     $this->assertEquals('bar', $newAuthor->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $newAuthor->extensionAttributes['foo2']['value']);
 }
Пример #2
0
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
     case $this->lookupNamespace('atom') . ':' . 'author':
         $author = new Extension\Author();
         $author->transferFromDOM($child);
         $this->_author[] = $author;
         break;
     case $this->lookupNamespace('atom') . ':' . 'category':
         $category = new Extension\Category();
         $category->transferFromDOM($child);
         $this->_category[] = $category;
         break;
     case $this->lookupNamespace('atom') . ':' . 'contributor':
         $contributor = new Extension\Contributor();
         $contributor->transferFromDOM($child);
         $this->_contributor[] = $contributor;
         break;
     case $this->lookupNamespace('atom') . ':' . 'id':
         $id = new Extension\Id();
         $id->transferFromDOM($child);
         $this->_id = $id;
         break;
     case $this->lookupNamespace('atom') . ':' . 'link':
         $link = new Extension\Link();
         $link->transferFromDOM($child);
         $this->_link[] = $link;
         break;
     case $this->lookupNamespace('atom') . ':' . 'rights':
         $rights = new Extension\Rights();
         $rights->transferFromDOM($child);
         $this->_rights = $rights;
         break;
     case $this->lookupNamespace('atom') . ':' . 'title':
         $title = new Extension\Title();
         $title->transferFromDOM($child);
         $this->_title = $title;
         break;
     case $this->lookupNamespace('atom') . ':' . 'updated':
         $updated = new Extension\Updated();
         $updated->transferFromDOM($child);
         $this->_updated = $updated;
         break;
     default:
         parent::takeChildFromDOM($child);
         break;
     }
 }