本文整理匯總了PHP中Sylius\Component\Core\Model\OrderInterface::removeItem方法的典型用法代碼示例。如果您正苦於以下問題:PHP OrderInterface::removeItem方法的具體用法?PHP OrderInterface::removeItem怎麽用?PHP OrderInterface::removeItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sylius\Component\Core\Model\OrderInterface
的用法示例。
在下文中一共展示了OrderInterface::removeItem方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_reverts_product($orderItemQuantityModifier, $variantRepository, FactoryInterface $itemFactory, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, PromotionInterface $promotion)
{
$variantRepository->find(500)->willReturn($variant);
$itemFactory->createNew()->willReturn($item);
$item->setUnitPrice(2)->willReturn($item);
$item->setVariant($variant)->willReturn($item);
$orderItemQuantityModifier->modify($item, 3)->shouldBeCalled();
$item->equals($item)->willReturn(true);
$item->setImmutable(true)->shouldBeCalled();
$order->getItems()->willReturn([$item]);
$order->removeItem($item)->shouldBeCalled();
$this->revert($order, ['variant' => 500, 'quantity' => 3, 'price' => 2], $promotion);
}
示例2: array
function it_reverts_product(RepositoryInterface $variantRepository, RepositoryInterface $itemRepository, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, PromotionInterface $promotion)
{
$configuration = array('variant' => 500, 'quantity' => 3, 'price' => 2);
$variantRepository->find($configuration['variant'])->willReturn($variant);
$itemRepository->createNew()->willReturn($item);
$item->setUnitPrice($configuration['price'])->shouldBeCalled()->willReturn($item);
$item->setVariant($variant)->shouldBeCalled()->willReturn($item);
$item->setQuantity($configuration['quantity'])->shouldBeCalled()->willReturn($item);
$item->equals($item)->willReturn(true);
$order->getItems()->willReturn(array($item));
$order->removeItem($item)->shouldBeCalled();
$this->revert($order, $configuration, $promotion);
}