public function testAllGetCouponsByIds() { $coupon1 = $this->dummyData->getCoupon(); $this->couponRepository->shouldReceive('getAllCouponsByIds')->with([$coupon1->getId()], null)->andReturn([$coupon1])->once(); $coupons = $this->couponService->getAllCouponsByIds([$coupon1->getId()]); $this->assertSame($coupon1, $coupons[0]); }
public function testRemoveCoupon() { $coupon = $this->dummyData->getCoupon(); $cart = $this->getCartThatRepositoryWillFind(); $cart->addCoupon($coupon); $this->cartRepositoryShouldUpdateOnce($cart); $this->couponRepository->shouldReceive('findOneById')->with($coupon->getId())->andReturn($coupon); $this->cartService->removeCoupon($cart->getId(), $coupon->getId()); $this->assertCount(0, $cart->getCoupons()); }