Beispiel #1
0
 public function testToAndFromString()
 {
     $this->itemEntry->setItemType('products');
     $this->assertEquals($this->itemEntry->getItemType()->getText(), 'products');
     $this->itemEntry->addGBaseAttribute('price', '10.99 USD', 'floatUnit');
     $baseAttribute = $this->itemEntry->getGBaseAttribute('price');
     $this->assertEquals(count($baseAttribute), 1);
     $this->assertEquals($baseAttribute[0]->getName(), 'price');
     $this->assertEquals($baseAttribute[0]->getText(), '10.99 USD');
     $this->assertEquals($baseAttribute[0]->getType(), 'floatUnit');
     $newItemEntry = new GBase\ItemEntry();
     $doc = new \DOMDocument();
     $doc->loadXML($this->itemEntry->saveXML());
     $newItemEntry->transferFromDom($doc->documentElement);
     $rowDataFromXML = $newItemEntry->getGBaseAttribute('price');
     $this->assertEquals($this->itemEntry->getItemType()->getText(), $newItemEntry->getItemType()->getText());
     $this->assertEquals(count($rowDataFromXML), 1);
     $this->assertEquals($rowDataFromXML[0]->getName(), 'price');
     $this->assertEquals($rowDataFromXML[0]->getText(), '10.99 USD');
     $this->assertEquals($rowDataFromXML[0]->getType(), 'floatUnit');
 }