/**
  * Test cart with stackable coupon and all stacked coupons are stackable.
  *
  * @covers checkStackableCoupon
  *
  * @dataProvider dataCheckStackableCoupon
  */
 public function testCheckStackableCoupon($couponStackable, $stackables, $expectsException)
 {
     $cart = $this->prophesize('Elcodi\\Component\\Cart\\Entity\\Interfaces\\CartInterface')->reveal();
     $coupon = $this->prophesize('Elcodi\\Component\\Coupon\\Entity\\Interfaces\\CouponInterface');
     $coupon->getStackable()->willReturn($couponStackable);
     $cartCouponRepository = $this->prophesize('Elcodi\\Component\\CartCoupon\\Repository\\CartCouponRepository');
     $cartCouponRepository->findBy(['cart' => $cart])->willReturn($this->getCartCouponsArray($stackables));
     $stackableCouponChecker = new StackableCouponValidator($cartCouponRepository->reveal());
     try {
         $stackableCouponChecker->validateStackableCoupon($cart, $coupon->reveal());
     } catch (CouponNotStackableException $exception) {
         if (!$expectsException) {
             throw $exception;
         }
     }
 }
 /**
  * Check if this coupon can be applied when other coupons had previously
  * been applied.
  *
  * @param CartCouponOnApplyEvent $event Event
  */
 public function validateStackableCoupon(CartCouponOnApplyEvent $event)
 {
     $this->stackableCouponValidator->validateStackableCoupon($event->getCart(), $event->getCoupon());
 }