Esempio n. 1
0
 public function testToAndFromString()
 {
     $this->baseAttribute->setName('price');
     $this->baseAttribute->setText('10.99 USD');
     $this->baseAttribute->setType('floatUnit');
     $this->assertTrue($this->baseAttribute->getName() == 'price');
     $this->assertTrue($this->baseAttribute->getText() == '10.99 USD');
     $this->assertTrue($this->baseAttribute->getType() == 'floatUnit');
     $newBaseAttribute = new Extension\BaseAttribute();
     $doc = new \DOMDocument();
     $doc->loadXML($this->baseAttribute->saveXML());
     $newBaseAttribute->transferFromDom($doc->documentElement);
     $this->assertTrue($this->baseAttribute->getName() == $newBaseAttribute->getName());
     $this->assertTrue($this->baseAttribute->getText() == $newBaseAttribute->getText());
     $this->assertTrue($this->baseAttribute->getType() == $newBaseAttribute->getType());
 }
Esempio n. 2
0
 /**
  * Creates individual Entry objects of the appropriate type and
  * stores them as members of this entry based upon DOM data.
  *
  * @param DOMNode $child The DOMNode to process
  */
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     if (strstr($absoluteNodeName, $this->lookupNamespace('g') . ':')) {
         $baseAttribute = new Extension\BaseAttribute();
         $baseAttribute->transferFromDOM($child);
         $this->_baseAttributes[] = $baseAttribute;
     } else {
         parent::takeChildFromDOM($child);
     }
 }