예제 #1
0
 function it_throws_exception_when_a_coupon_is_found_but_it_should_not_exist(CouponInterface $coupon, RepositoryInterface $couponRepository)
 {
     $coupon->getCode()->willReturn('christmas_coupon');
     $couponRepository->findOneBy(['code' => 'christmas_coupon'])->willReturn($coupon);
     $this->shouldThrow(NotEqualException::class)->during('couponShouldNotExistInTheRegistry', [$coupon]);
 }
 function it_should_transform_coupon_into_its_code(CouponInterface $coupon)
 {
     $coupon->getCode()->willReturn('C123');
     $this->transform($coupon)->shouldReturn('C123');
 }
예제 #3
0
 /**
  * @Then /^(this coupon) should no longer exist in the coupon registry$/
  */
 public function couponShouldNotExistInTheRegistry(CouponInterface $coupon)
 {
     expect($this->couponRepository->findOneBy(['code' => $coupon->getCode()]))->toBe(null);
 }
예제 #4
0
 /**
  * @Then /^(this coupon) should no longer exist in the coupon registry$/
  */
 public function couponShouldNotExistInTheRegistry(CouponInterface $coupon)
 {
     Assert::null($this->couponRepository->findOneBy(['code' => $coupon->getCode()]), sprintf('The coupon with code %s should not exist', $coupon->getCode()));
 }
예제 #5
0
 function it_gets_coupon_by_its_code(RepositoryInterface $couponRepository, CouponInterface $coupon)
 {
     $coupon->getCode()->willReturn('BEST-CODE');
     $couponRepository->findOneBy(['code' => 'BEST-CODE'])->willReturn($coupon);
     $this->getCouponByCode('BEST-CODE');
 }