function it_returns_false_if_usage_limit_has_been_reached(PromotionSubjectInterface $promotionSubject, PromotionCouponInterface $promotionCoupon) { $promotionCoupon->getUsageLimit()->willReturn(42); $promotionCoupon->getUsed()->willReturn(42); $this->isEligible($promotionSubject, $promotionCoupon)->shouldReturn(false); }
/** * {@inheritdoc} */ public function isEligible(PromotionSubjectInterface $promotionSubject, PromotionCouponInterface $promotionCoupon) { $usageLimit = $promotionCoupon->getUsageLimit(); return $usageLimit === null || $promotionCoupon->getUsed() < $usageLimit; }