/**
  * Test related methods
  */
 public function testGuessUpdates()
 {
     $attribute = new Attribute();
     $attribute->setCode('my_attribute');
     $value = new ProductValue();
     $value->setAttribute($attribute);
     $product = new Product();
     $product->addValue($value);
     $guesser = new ProductValueUpdateGuesser();
     $em = $this->getEntityManagerMock();
     $updates = $guesser->guessUpdates($em, $value, UpdateGuesserInterface::ACTION_UPDATE_ENTITY);
     $this->assertEquals(1, count($updates));
     $this->assertEquals($product, $updates[0]);
     $attribute = new Attribute();
     $attribute->setCode('my_price');
     $price = new ProductPrice();
     $value = new ProductValue();
     $value->setAttribute($attribute);
     $value->addPrice($price);
     $product = new Product();
     $product->addValue($value);
     $updates = $guesser->guessUpdates($em, $price, UpdateGuesserInterface::ACTION_UPDATE_ENTITY);
     $this->assertEquals(1, count($updates));
     $this->assertEquals($product, $updates[0]);
 }
 /**
  * Test getter for media
  */
 public function testGetMedia()
 {
     $this->product->addValue($this->getValueMock($this->getAttributeMock(null, 'pim_catalog_identifier', 'sku')));
     $this->product->addValue($this->getValueMock($this->getAttributeMock(null, 'pim_catalog_text', 'name')));
     $this->product->addValue($this->getValueMock($this->getAttributeMock(null, 'pim_catalog_image', 'view'), $view = $this->getMediaMock()));
     $this->product->addValue($this->getValueMock($this->getAttributeMock(null, 'pim_catalog_file', 'manual'), $manual = $this->getMediaMock()));
     $this->assertEquals(array($view, $manual), $this->product->getMedia());
 }
 /**
  * {@inheritDoc}
  */
 public function addValue(\Pim\Bundle\CatalogBundle\Model\ProductValueInterface $value)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'addValue', array($value));
     return parent::addValue($value);
 }