public function testBuildElementWithVariations()
 {
     $parent = new Product();
     $parent->setSku('sku_2');
     $image = new Image();
     $image->setSource('http://www.brand.com/product/image.jpg');
     $product = new Variation();
     $product->setProduct($parent);
     $product->setImages(new ArrayCollection(array($image)));
     $collection = new ArrayCollection();
     $collection->add($product);
     // Some properties explicitly declared on CommonProduct
     $product->setSku('sku_1');
     $product->setStatus('Online');
     $product->setTitle('Product');
     $product->getMeta()->offsetSet('brand', 'Brand');
     $product->setUpc('000000000000');
     $product->setLength(1);
     $product->setWidth(1);
     $product->setHeight(1);
     $product->setDimensionUnit('MM');
     $product->setWeight(1);
     $product->setWeightUnit('GR');
     $product->setCurrency('USD');
     $product->setMsrp(5000);
     $product->setPrice(2500);
     $product->setQuantity(5);
     // If a property is not explicitly declared, it goes in Meta
     $product->getMeta()->offsetSet('category', '100166');
     $product->getMeta()->offsetSet('color', 'blue');
     $product->getMeta()->offsetSet('size', 'small');
     $product->getMeta()->offsetSet('link', 'http://www.brand.com/product');
     $product->getMeta()->offsetSet('startDate', '11/12/2014');
     $product->getMeta()->offsetSet('endDate', '12/12/2014');
     $product->getMeta()->offsetSet('shipper', 'Supplier');
     $product->getMeta()->offsetSet('basicCost', 5000);
     $product->getMeta()->offsetSet('dropshipFee', 199);
     $element = $this->requestHandler->buildElement($collection);
     $xml = $element->asXML();
     $expectedXml = file_get_contents(dirname(__DIR__) . '/Resources/SingleFeed-2013-10-01-053333_with_variation.xml');
     $this->assertXmlStringEqualsXmlString($expectedXml, $xml);
 }
示例#2
0
 public function __construct()
 {
     parent::__construct();
     $this->options = new ArrayCollection();
 }