function let(ChannelManager $channelManager, MediaManager $mediaManager, ProductValueNormalizer $productValueNormalizer, CategoryMappingManager $categoryMappingManager, AssociationTypeManager $associationTypeManager, MappingCollection $storeViewMapping, MappingCollection $categoryMapping, MappingCollection $attributeMapping, Product $product, ProductValue $productValue, ProductValue $imageValue, Channel $channel, Locale $localeFR, Locale $localeEN, Category $category, ExportableLocaleFilter $localeFilter)
 {
     $this->beConstructedWith($channelManager, $mediaManager, $productValueNormalizer, $categoryMappingManager, $associationTypeManager, $localeFilter, 1, 4, 1, 'currency', 'magento_url');
     $this->globalContext = ['attributeSetId' => 0, 'magentoAttributes' => [], 'magentoAttributesOptions' => [], 'storeViewMapping' => $storeViewMapping, 'magentoStoreViews' => [['code' => 'fr_fr']], 'defaultLocale' => 'default_locale', 'website' => 'website', 'channel' => 'channel', 'categoryMapping' => $categoryMapping, 'attributeCodeMapping' => $attributeMapping, 'create' => true, 'pimGrouped' => 'pim_grouped', 'created_date' => new \DateTime(), 'updated_date' => new \DateTime(), 'defaultStoreView' => 'default', 'smallImageAttribute' => 'small_image_attribute', 'baseImageAttribute' => 'image_attribute', 'thumbnailAttribute' => 'image_attribute', 'urlKey' => false, 'skuFirst' => false];
     $attributeMapping->getTarget('visibility')->willReturn('visibility');
     $attributeMapping->getTarget('created_at')->willReturn('created_at');
     $attributeMapping->getTarget('updated_at')->willReturn('updated_at');
     $attributeMapping->getTarget('status')->willReturn('status');
     $attributeMapping->getTarget('categories')->willReturn('categories');
     $attributeMapping->getTarget('url_key')->willReturn('url_key');
     $attributeMapping->getSource('name')->willReturn('my-name');
     $channelManager->getChannelByCode('channel')->willReturn($channel);
     $channel->getLocales()->willReturn([$localeEN, $localeFR]);
     $localeEN->getCode()->willReturn('default_locale');
     $localeFR->getCode()->willReturn('fr_FR');
     $channel->getCode()->willReturn('channel_code');
     $channel->getCategory()->willReturn($category);
     $product->getCategories()->willReturn([$category]);
     $product->getIdentifier()->willReturn('sku-000');
     $product->getCreated()->willReturn($this->globalContext['created_date']);
     $product->getUpdated()->willReturn($this->globalContext['updated_date']);
     $product->getValues()->willReturn(new ArrayCollection([$productValue, $imageValue]));
     $product->getValue('my-name', Argument::any(), Argument::any())->willReturn('my-name');
     $storeViewMapping->getTarget('default_locale')->willReturn('default_locale');
     $storeViewMapping->getTarget('fr_FR')->willReturn('fr_fr');
     $categoryMappingManager->getIdFromCategory($category, 'magento_url', $categoryMapping)->willReturn(2);
     $productValueNormalizer->normalize($productValue, Argument::cetera())->willReturn(['value' => 'productValueNormalized']);
     $productValueNormalizer->normalize($imageValue, Argument::cetera())->willReturn(null);
 }
 /**
  * Get product price from generated mapping.
  *
  * @param ProductInterface  $product
  * @param array             $priceChanges
  * @param float             $basePrice
  * @param MappingCollection $attributeMapping
  *
  * @return float
  */
 protected function getProductPriceFromMapping(ProductInterface $product, array $priceChanges, $basePrice, MappingCollection $attributeMapping)
 {
     $priceFromMapping = $basePrice;
     foreach ($priceChanges as $attributeCode => $attributePriceMapping) {
         $priceFromMapping += $this->getAttributePriceFromMapping($product, $attributeMapping->getSource($attributeCode), $attributePriceMapping);
     }
     return $priceFromMapping;
 }
 /**
  * Get normalized labels for attribute.
  *
  * @param AbstractAttribute $attribute
  * @param array             $magentoStoreViews
  * @param string            $defaultLocale
  * @param MappingCollection $storeViewMapping
  * @param MappingCollection $attributeMapping
  *
  * @return array
  */
 protected function getNormalizedLabels(AbstractAttribute $attribute, array $magentoStoreViews, $defaultLocale, MappingCollection $storeViewMapping, MappingCollection $attributeMapping)
 {
     $localizedLabels = [];
     foreach ($magentoStoreViews as $magentoStoreView) {
         $localeCode = $storeViewMapping->getSource($magentoStoreView['code']);
         $localizedLabels[] = ['store_id' => $magentoStoreView['store_id'], 'label' => $this->getAttributeTranslation($attribute, $localeCode, $defaultLocale)];
     }
     return array_merge([['store_id' => 0, 'label' => strtolower($attributeMapping->getTarget($attribute->getCode()))]], $localizedLabels);
 }
 /**
  * Generate url key from product name and identifier.
  * The identifier is included to make sure the url_key is unique, as required in Magento.
  *
  * If name is localized, the default locale is used to get the value.
  *
  * @param ProductInterface  $product
  * @param MappingCollection $attributeCodeMapping
  * @param string            $localeCode
  * @param string            $scopeCode
  * @param boolean           $skuFirst
  *
  * @return string
  */
 protected function generateUrlKey(ProductInterface $product, MappingCollection $attributeCodeMapping, $localeCode, $scopeCode, $skuFirst = false)
 {
     $identifier = $product->getIdentifier();
     $nameAttribute = $attributeCodeMapping->getSource(self::NAME);
     $name = $product->getValue($nameAttribute, $localeCode, $scopeCode);
     if (false === $skuFirst) {
         $url = Urlizer::urlize($name . '-' . $identifier);
     } else {
         $url = Urlizer::urlize($identifier . '-' . $name);
     }
     return $url;
 }