本文整理汇总了PHP中Sylius\Component\Core\Model\OrderItemInterface::isImmutable方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderItemInterface::isImmutable方法的具体用法?PHP OrderItemInterface::isImmutable怎么用?PHP OrderItemInterface::isImmutable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Model\OrderItemInterface
的用法示例。
在下文中一共展示了OrderItemInterface::isImmutable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_recalculates_prices_without_adding_anything_to_the_context_if_its_not_needed(DelegatingCalculatorInterface $priceCalculator, OrderInterface $order, OrderItemInterface $item, PriceableInterface $variant)
{
$order->getCustomer()->willReturn(null);
$order->getChannel()->willReturn(null);
$order->getItems()->willReturn([$item]);
$item->isImmutable()->willReturn(false);
$item->getQuantity()->willReturn(5);
$item->getVariant()->willReturn($variant);
$priceCalculator->calculate($variant, ['quantity' => 5])->willReturn(10);
$item->setUnitPrice(10)->shouldBeCalled();
$this->process($order);
}
示例2:
function it_recalculates_prices_adding_customer_to_the_context(ChannelInterface $channel, CustomerGroupInterface $group, CustomerInterface $customer, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, ProductVariantPriceCalculatorInterface $productVariantPriceCalculator)
{
$order->getCustomer()->willReturn($customer);
$order->getChannel()->willReturn(null);
$order->getItems()->willReturn([$item]);
$order->getCurrencyCode()->willReturn(null);
$customer->getGroup()->willReturn($group);
$item->isImmutable()->willReturn(false);
$item->getQuantity()->willReturn(5);
$item->getVariant()->willReturn($variant);
$order->getChannel()->willReturn($channel);
$productVariantPriceCalculator->calculate($variant, ['channel' => $channel])->willReturn(10);
$item->setUnitPrice(10)->shouldBeCalled();
$this->process($order);
}
示例3: array
function it_recalculates_prices_adding_all_context(GenericEvent $event, OrderInterface $order, OrderItemInterface $item, DelegatingCalculatorInterface $priceCalculator, GroupableInterface $customer, ArrayCollection $groups, ChannelInterface $channel, PriceableInterface $variant)
{
$event->getSubject()->shouldBeCalled()->willReturn($order);
$order->getCustomer()->shouldBeCalled()->willReturn($customer);
$order->getChannel()->shouldBeCalled()->willReturn($channel);
$order->getItems()->shouldBeCalled()->willReturn(array($item));
$order->calculateTotal()->shouldBeCalled();
$customer->getGroups()->shouldBeCalled()->willReturn($groups);
$groups->toArray()->shouldBeCalled()->willReturn(array('group1', 'group2'));
$item->isImmutable()->shouldBeCalled()->willReturn(false);
$item->getQuantity()->shouldBeCalled()->willReturn(5);
$item->setUnitPrice(10)->shouldBeCalled();
$item->getVariant()->shouldBeCalled()->willReturn($variant);
$priceCalculator->calculate($variant, array('customer' => $customer, 'groups' => array('group1', 'group2'), 'channel' => array($channel), 'quantity' => 5))->shouldBeCalled()->willReturn(10);
$this->recalculatePrices($event);
}