当前位置: 首页>>代码示例>>PHP>>正文


PHP OrderItemInterface::isImmutable方法代码示例

本文整理汇总了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);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:12,代码来源:OrderPricesRecalculatorSpec.php

示例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);
 }
开发者ID:sylius,项目名称:core,代码行数:15,代码来源:OrderPricesRecalculatorSpec.php

示例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);
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:16,代码来源:OrderPricingListenerSpec.php


注:本文中的Sylius\Component\Core\Model\OrderItemInterface::isImmutable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。