本文整理匯總了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);
}