function it_updates_normalized_product_template_values_if_media_values_have_been_handled($normalizer, ProductTemplateInterface $imageTemplate, ProductTemplateInterface $textTemplate, ProductValueInterface $imageValue, ProductValueInterface $textValue, FileInterface $imageMedia)
 {
     $normalizer->normalize(Argument::cetera())->willReturn([]);
     $imageTemplate->getValues()->willReturn([$imageValue]);
     $imageValue->getMedia()->willReturn($imageMedia);
     $imageMedia->isRemoved()->willReturn(true);
     $imageValue->setMedia(null)->shouldBeCalled();
     $imageTemplate->setValuesData([])->shouldBeCalled();
     $textTemplate->getValues()->willReturn([$textValue]);
     $textTemplate->setValuesData([])->shouldNotBeCalled();
     $this->handleProductTemplateMedia($imageTemplate);
     $this->handleProductTemplateMedia($textTemplate);
 }
 /**
  * TODO: remove this method after the refactoring of the product media manager
  *
  * @param ProductInterface      $product
  * @param ProductValueInterface $fromValue
  * @param ProductValueInterface $toValue
  */
 protected function duplicateMedia(ProductInterface $product, ProductValueInterface $fromValue, ProductValueInterface $toValue)
 {
     if (null === $toValue->getMedia()) {
         $media = $this->mediaFactory->createMedia();
         $toValue->setMedia($media);
     }
     $this->mediaManager->duplicate($fromValue->getMedia(), $toValue->getMedia(), $this->mediaManager->generateFilenamePrefix($product, $fromValue));
 }
 /**
  * @param ProductValueInterface $productValue
  * @param ProductValueInterface $value
  */
 protected function setProductFile(ProductValueInterface $productValue, ProductValueInterface $value)
 {
     if (null === ($media = $productValue->getMedia())) {
         $media = new $this->productMediaClass();
         $productValue->setMedia($media);
     }
     $file = $value->getMedia()->getFile();
     if ($file) {
         $media->setFile($file);
     } else {
         $media->setRemoved(true);
     }
 }