/**
  * Returns an array containing the currency values
  *
  * @param ChannelInterface $channel
  *
  * @return array
  */
 protected function normalizeCurrencies(ChannelInterface $channel)
 {
     $currencies = array();
     foreach ($channel->getCurrencies() as $currency) {
         $currencies[] = $currency->getCode();
     }
     return $currencies;
 }
 public function it_succesfully_checks_incomplete_price_collection(ProductValueInterface $value, ChannelInterface $channel, LocaleInterface $locale, ArrayCollection $arrayCollection, CurrencyInterface $currency1, CurrencyInterface $currency2, ProductPriceInterface $price1)
 {
     $channel->getCurrencies()->willReturn($arrayCollection);
     $arrayCollection->toArray()->willReturn([$currency1, $currency2]);
     $currency1->getCode()->willReturn('USD');
     $price1->getCurrency()->willReturn('USD');
     $price1->getData()->willReturn(null);
     $value->getData()->willReturn([$price1]);
     $this->isComplete($value, $channel, $locale)->shouldReturn(false);
 }
 /**
  * {@inheritdoc}
  */
 public function isComplete(ProductValueInterface $productValue, ChannelInterface $channel = null, LocaleInterface $locale = null)
 {
     $expectedCurrencies = array_map(function ($currency) {
         return $currency->getCode();
     }, $channel->getCurrencies()->toArray());
     foreach ($expectedCurrencies as $currency) {
         foreach ($productValue->getData() as $price) {
             if ($price->getCurrency() === $currency && null === $price->getData()) {
                 return false;
             }
         }
     }
     return true;
 }
 function it_normalizes_channel(ChannelInterface $channel, CurrencyInterface $eur, CurrencyInterface $usd, LocaleInterface $en, LocaleInterface $fr, CategoryInterface $category)
 {
     $channel->getCode()->willReturn('ecommerce');
     $channel->getLabel()->willReturn('Ecommerce');
     $channel->getCurrencies()->willReturn([$eur, $usd]);
     $eur->getCode()->willReturn('EUR');
     $usd->getCode()->willReturn('USD');
     $channel->getLocales()->willReturn([$en, $fr]);
     $en->getCode()->willReturn('en_US');
     $fr->getCode()->willReturn('fr_FR');
     $channel->getCategory()->willReturn($category);
     $category->getCode()->willReturn('Master catalog');
     $channel->getConversionUnits()->willReturn(['Weight' => 'Kilogram', 'Size' => 'Centimeter']);
     $this->normalize($channel)->shouldReturn(['code' => 'ecommerce', 'label' => 'Ecommerce', 'currencies' => ['EUR', 'USD'], 'locales' => ['en_US', 'fr_FR'], 'category' => 'Master catalog', 'conversion_units' => 'Weight: Kilogram, Size: Centimeter']);
 }