Exemplo n.º 1
0
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('openSearch') . ':' . 'totalResults':
             $totalResults = new Zend_Gdata_Extension_OpenSearchTotalResults();
             $totalResults->transferFromDOM($child);
             $this->_totalResults = $totalResults;
             break;
         case $this->lookupNamespace('openSearch') . ':' . 'startIndex':
             $startIndex = new Zend_Gdata_Extension_OpenSearchStartIndex();
             $startIndex->transferFromDOM($child);
             $this->_startIndex = $startIndex;
             break;
         case $this->lookupNamespace('openSearch') . ':' . 'itemsPerPage':
             $itemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage();
             $itemsPerPage->transferFromDOM($child);
             $this->_itemsPerPage = $itemsPerPage;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
 public function testExtensionAttributes()
 {
     $extensionAttributes = $this->openSearchItemsPerPage->extensionAttributes;
     $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar');
     $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab');
     $this->openSearchItemsPerPage->extensionAttributes = $extensionAttributes;
     $this->assertEquals('bar', $this->openSearchItemsPerPage->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $this->openSearchItemsPerPage->extensionAttributes['foo2']['value']);
     $openSearchItemsPerPageXml = $this->openSearchItemsPerPage->saveXML();
     $newOpenSearchItemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage();
     $newOpenSearchItemsPerPage->transferFromXML($openSearchItemsPerPageXml);
     $this->assertEquals('bar', $newOpenSearchItemsPerPage->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $newOpenSearchItemsPerPage->extensionAttributes['foo2']['value']);
 }