function it_throws_exception_when_a_promotion_is_not_found_but_it_should_exist(PromotionRepositoryInterface $promotionRepository, PromotionInterface $promotion) { $promotion->getId()->willReturn(5); $promotionRepository->find(5)->willReturn(null); $this->shouldThrow(FailureException::class)->during('promotionShouldStillExistInTheRegistry', [$promotion]); }
/** * @Then promotion :promotion should still exist in the registry */ public function promotionShouldStillExistInTheRegistry(PromotionInterface $promotion) { Assert::notNull($this->promotionRepository->find($promotion->getId())); }
/** * @Then /^there should still be only one coupon with code "([^"]+)" related to (this promotion)$/ */ public function thereShouldStillBeOnlyOneCouponWithCodeRelatedTo($code, PromotionInterface $promotion) { $this->indexPage->open(['promotionId' => $promotion->getId()]); Assert::true($this->indexPage->isSingleResourceOnPage(['code' => $code]), sprintf('There is no coupon with code %s.', $code)); }
/** * @Then promotion :promotion should still exist in the registry */ public function promotionShouldStillExistInTheRegistry(PromotionInterface $promotion) { expect($this->promotionRepository->find($promotion->getId()))->toNotBe(null); }