function it_removes_channel_pricings_with_not_specified_price_on_submit(ChannelPricingInterface $channelPricingWithPrice, ChannelPricingInterface $channelPricingWithoutPrice, FormEvent $formEvent, ProductVariantInterface $productVariant)
 {
     $formEvent->getData()->willReturn($productVariant);
     $productVariant->getChannelPricings()->willReturn(new ArrayCollection([$channelPricingWithPrice->getWrappedObject(), $channelPricingWithoutPrice->getWrappedObject()]));
     $channelPricingWithoutPrice->getPrice()->willReturn(null);
     $channelPricingWithPrice->getPrice()->willReturn(123);
     $productVariant->removeChannelPricing($channelPricingWithoutPrice)->shouldBeCalled();
     $channelPricingWithoutPrice->setProductVariant(null)->shouldBeCalled();
     $productVariant->removeChannelPricing($channelPricingWithPrice)->shouldNotBeCalled();
     $channelPricingWithPrice->setProductVariant(null)->shouldNotBeCalled();
     $this->submit($formEvent);
 }
Beispiel #2
0
 function it_returns_channel_pricing_for_given_channel(ChannelInterface $channel, ChannelPricingInterface $channelPricing)
 {
     $channelPricing->setProductVariant($this)->shouldBeCalled();
     $this->addChannelPricing($channelPricing);
     $channelPricing->getChannel()->willReturn($channel);
     $this->getChannelPricingForChannel($channel)->shouldReturn($channelPricing);
 }