本文整理汇总了PHP中Sylius\Component\Promotion\Model\PromotionInterface::getUsed方法的典型用法代码示例。如果您正苦于以下问题:PHP PromotionInterface::getUsed方法的具体用法?PHP PromotionInterface::getUsed怎么用?PHP PromotionInterface::getUsed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Promotion\Model\PromotionInterface
的用法示例。
在下文中一共展示了PromotionInterface::getUsed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_decrements_promotion_usage_if_promotion_was_used(OrderInterface $order, PromotionInterface $promotion)
{
$order->getPromotions()->willReturn([$promotion]);
$promotion->getUsed()->willReturn(5);
$promotion->setUsed(4)->shouldBeCalled();
$this->decrementPromotionUsage($order);
}
示例2: isEligible
/**
* {@inheritdoc}
*/
public function isEligible(PromotionInterface $promotion)
{
if (null === ($usageLimit = $promotion->getUsageLimit())) {
return true;
}
if ($promotion->getUsed() < $usageLimit) {
return true;
}
return false;
}
示例3: isEligibleToUsageLimit
/**
* Checks if promotion usage limit has been reached.
*
* @param PromotionInterface $promotion
*
* @return bool
*/
protected function isEligibleToUsageLimit(PromotionInterface $promotion)
{
if (null !== ($usageLimit = $promotion->getUsageLimit())) {
if ($promotion->getUsed() >= $usageLimit) {
return false;
}
}
return true;
}
示例4:
function it_returns_false_if_usage_limit_has_been_exceeded(PromotionSubjectInterface $promotionSubject, PromotionInterface $promotion)
{
$promotion->getUsageLimit()->willReturn(10);
$promotion->getUsed()->willReturn(15);
$this->isEligible($promotionSubject, $promotion)->shouldReturn(false);
}