function it_returns_flat_data_without_media($productBuilder, ChannelInterface $channel, LocaleInterface $locale, ChannelManager $channelManager, ProductInterface $product, Serializer $serializer) { $localeCodes = ['en_US']; $channel->getLocales()->willReturn(new ArrayCollection([$locale])); $channel->getLocaleCodes()->willReturn($localeCodes); $productBuilder->addMissingProductValues($product, [$channel], [$locale])->shouldBeCalled(); $product->getValues()->willReturn([]); $this->setDecimalSeparator(','); $serializer->normalize($product, 'flat', ['scopeCode' => 'foobar', 'localeCodes' => $localeCodes, 'decimal_separator' => ',', 'date_format' => 'yyyy-MM-dd'])->willReturn(['normalized_product']); $channelManager->getChannelByCode('foobar')->willReturn($channel); $this->setChannel('foobar'); $this->process($product)->shouldReturn(['media' => [], 'product' => ['normalized_product']]); }
function it_normalizes_channel(ChannelInterface $channel, CategoryInterface $category, CurrencyInterface $currencyUSD, CurrencyInterface $currencyEUR) { $units = ['weight_attribute' => WeightFamilyInterface::GRAM, 'length_attribute' => LengthFamilyInterface::CENTIMETER]; $channel->getCode()->willReturn('my_code'); $channel->getLabel()->willReturn('my_label'); $channel->getCurrencies()->willReturn([$currencyEUR, $currencyUSD]); $channel->getLocaleCodes()->willReturn(['fr_FR', 'en_US', 'de_DE', 'es_ES']); $channel->getCategory()->willReturn($category); $channel->getConversionUnits()->willReturn($units); $category->getCode()->willReturn('winter'); $currencyEUR->getCode()->willReturn('EUR'); $currencyUSD->getCode()->willReturn('USD'); $this->normalize($channel, 'standard', [])->shouldReturn(['code' => 'my_code', 'label' => 'my_label', 'currencies' => ['EUR', 'USD'], 'locales' => ['fr_FR', 'en_US', 'de_DE', 'es_ES'], 'category_tree' => 'winter', 'conversion_units' => $units]); }