/**
  * @test
  */
 public function canInitializeProductFromProductXml()
 {
     $expectedXml = $this->getFixtureContent('Api/Client/Domain/Document/Fixture/testproduct.xml');
     $this->product->__setProperty('content', $expectedXml);
     $this->product->afterReconstitution();
     $this->assertSame(118948, $this->product->getProductId(), 'Could not get product with expected productId');
     $this->assertSame(1, $this->product->getStoreId(), 'Could not restore storeId');
     $this->assertSame("de_DE", $this->product->getLanguage(), 'Could not restore language');
     $this->assertSame("103115", $this->product->getSku(), 'Could not restore sku');
     $this->assertSame("Foo", $this->product->getTitle(), 'Could not restore title');
     $this->assertSame("long description", $this->product->getDescription(), 'Could not restore description');
     $this->assertSame("short description", $this->product->getShortDescription(), 'Could not restore short description');
     $this->assertSame(42.36, $this->product->getPrice(), 'Could not restore price');
     $this->assertSame(100.0, $this->product->getSpecialPrice(), 'Could not get special price');
     $this->assertSame(101.0, $this->product->getGroupPrice(), 'Could not get group price');
     $this->assertSame('http://www.searchperience.de/test.gif', $this->product->getImageLink(), 'Could not restore image link');
     $this->assertSame(2, count($this->product->getCategoryPaths()), 'Could not restore category pathes');
     $this->assertSame(2, count($this->product->getAttributes()), 'Could not restore attributes');
 }
 /**
  * @param \DOMDocument $dom
  * @param \DOMElement $productNode
  * @param Product $product
  */
 protected function addCategoryPathNodesToContentDom($dom, \DOMElement $productNode, Product $product)
 {
     foreach ($product->getCategoryPaths() as $categoryPath) {
         /** @var $categoryPath \Searchperience\Api\Client\Domain\Document\ProductCategoryPath */
         $categoryPathNode = $dom->createElement("category_path", $categoryPath->getCategoryPath());
         $productNode->appendChild($categoryPathNode);
         $categoryIdNode = $dom->createElement("category_id", $categoryPath->getCategoryId());
         $productNode->appendChild($categoryIdNode);
     }
 }