function it_returns_false_if_promotion_coupon_has_already_expired(PromotionSubjectInterface $promotionSubject, PromotionCouponInterface $promotionCoupon) { $promotionCoupon->getExpiresAt()->willReturn(new \DateTime('yesterday')); $this->isEligible($promotionSubject, $promotionCoupon)->shouldReturn(false); }
/** * {@inheritdoc} */ public function isEligible(PromotionSubjectInterface $promotionSubject, PromotionCouponInterface $promotionCoupon) { $endsAt = $promotionCoupon->getExpiresAt(); return $endsAt === null || new \DateTime() < $endsAt; }