spec\Sylius\Bundle\CoreBundle\Form\EventSubscriber\ChannelPricingsFormSubscriberSpec::it_removes_channel_pricings_with_not_specified_price_on_submit PHP Метод

it_removes_channel_pricings_with_not_specified_price_on_submit() публичный Метод

public it_removes_channel_pricings_with_not_specified_price_on_submit ( Sylius\Component\Core\Model\ChannelPricingInterface $channelPricingWithPrice, Sylius\Component\Core\Model\ChannelPricingInterface $channelPricingWithoutPrice, Symfony\Component\Form\FormEvent $formEvent, Sylius\Component\Core\Model\ProductVariantInterface $productVariant )
$channelPricingWithPrice Sylius\Component\Core\Model\ChannelPricingInterface
$channelPricingWithoutPrice Sylius\Component\Core\Model\ChannelPricingInterface
$formEvent Symfony\Component\Form\FormEvent
$productVariant Sylius\Component\Core\Model\ProductVariantInterface
    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);
    }