本文整理汇总了PHP中Sylius\Component\Core\Model\ProductInterface::getPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductInterface::getPrice方法的具体用法?PHP ProductInterface::getPrice怎么用?PHP ProductInterface::getPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Model\ProductInterface
的用法示例。
在下文中一共展示了ProductInterface::getPrice方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_adds_single_item_by_customer(FactoryInterface $orderItemFactory, OrderInterface $order, OrderItemInterface $item, OrderItemQuantityModifierInterface $itemQuantityModifier, ProductInterface $product, SharedStorageInterface $sharedStorage, ProductVariantInterface $variant, ObjectManager $objectManager)
{
$sharedStorage->get('order')->willReturn($order);
$orderItemFactory->createNew()->willReturn($item);
$product->getMasterVariant()->willReturn($variant);
$product->getPrice()->willReturn(1234);
$itemQuantityModifier->modify($item, 1)->shouldBeCalled();
$item->setVariant($variant)->shouldBeCalled();
$item->setUnitPrice(1234)->shouldBeCalled();
$order->addItem($item)->shouldBeCalled();
$objectManager->flush()->shouldBeCalled();
$this->theCustomerBoughtSingle($product);
}
示例2: theCustomerBoughtSingleUsing
/**
* @Given the customer bought a single :product using :coupon coupon
*/
public function theCustomerBoughtSingleUsing(ProductInterface $product, CouponInterface $coupon)
{
$order = $this->addProductVariantToOrder($product->getFirstVariant(), $product->getPrice());
$order->setPromotionCoupon($coupon);
$this->orderRecalculator->recalculate($order);
$this->objectManager->flush();
}
示例3: theCustomerBoughtSingle
/**
* @Given the customer bought single :product
*/
public function theCustomerBoughtSingle(ProductInterface $product)
{
/** @var OrderInterface $order */
$order = $this->sharedStorage->get('order');
/** @var OrderItemInterface $item */
$item = $this->orderItemFactory->createNew();
$item->setVariant($product->getMasterVariant());
$item->setUnitPrice($product->getPrice());
$this->itemQuantityModifier->modify($item, 1);
$order->addItem($item);
$this->objectManager->flush();
}