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


PHP OrderItemInterface::addUnit方法代码示例

本文整理汇总了PHP中Sylius\Component\Core\Model\OrderItemInterface::addUnit方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderItemInterface::addUnit方法的具体用法?PHP OrderItemInterface::addUnit怎么用?PHP OrderItemInterface::addUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Component\Core\Model\OrderItemInterface的用法示例。


在下文中一共展示了OrderItemInterface::addUnit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ArrayCollection

 function it_creates_only_missing_inventory_units_via_the_factory($orderItemUnitFactory, OrderItemInterface $item, ProductVariantInterface $variant, OrderItemUnitInterface $unit1, OrderItemUnitInterface $unit2)
 {
     $item->getUnits()->shouldBeCalled()->willReturn(new ArrayCollection(array($unit1)));
     $unit1->getStockable()->willReturn($variant);
     $unit2->getStockable()->willReturn($variant);
     $item->getVariant()->willReturn($variant);
     $item->getQuantity()->willReturn(2);
     $item->getUnits()->willReturn(new ArrayCollection());
     $orderItemUnitFactory->createNew()->willReturn($unit2);
     $unit1->setInventoryState(InventoryUnitInterface::STATE_CHECKOUT)->shouldNotBeCalled();
     $unit2->setInventoryState(InventoryUnitInterface::STATE_CHECKOUT)->shouldBeCalled();
     $item->addUnit($unit1)->shouldNotBeCalled();
     $item->addUnit($unit2)->shouldBeCalled();
     $this->processInventoryUnits($item);
 }
开发者ID:Hsidhu,项目名称:Sylius,代码行数:15,代码来源:InventoryHandlerSpec.php

示例2:

 function it_does_nothing_if_target_quantity_is_below_0($orderItemUnitFactory, OrderItemInterface $orderItem)
 {
     $orderItem->getQuantity()->willReturn(3);
     $orderItemUnitFactory->createForItem(Argument::any())->shouldNotBeCalled();
     $orderItem->addUnit(Argument::any())->shouldNotBeCalled();
     $orderItem->removeUnit(Argument::any())->shouldNotBeCalled();
     $this->modify($orderItem, -10);
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:8,代码来源:OrderItemQuantityModifierSpec.php

示例3: let

 function let(OrderItemInterface $orderItem)
 {
     $orderItem->getUnitPrice()->willReturn(1000);
     $orderItem->addUnit(Argument::type(OrderItemUnitInterface::class))->shouldBeCalled();
     $this->beConstructedWith($orderItem);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:6,代码来源:OrderItemUnitSpec.php

示例4: createInventoryUnits

 /**
  * @param OrderItemInterface $item
  * @param int $quantity
  * @param string $state
  */
 protected function createInventoryUnits(OrderItemInterface $item, $quantity, $state = InventoryUnitInterface::STATE_CHECKOUT)
 {
     if ($quantity < 1) {
         throw new \InvalidArgumentException('Quantity of units must be greater than 0.');
     }
     for ($i = 0; $i < $quantity; $i++) {
         $unit = $this->orderItemUnitFactory->createNew();
         $unit->setInventoryState($state);
         $item->addUnit($unit);
     }
 }
开发者ID:Hsidhu,项目名称:Sylius,代码行数:16,代码来源:InventoryHandler.php


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