1 | <?php |
||
29 | final class ManagingPromotionCouponsContext implements Context |
||
30 | { |
||
31 | /** |
||
32 | * @var CreatePageInterface |
||
33 | */ |
||
34 | private $createPage; |
||
35 | |||
36 | /** |
||
37 | * @var GeneratePageInterface |
||
38 | */ |
||
39 | private $generatePage; |
||
40 | |||
41 | /** |
||
42 | * @var IndexPageInterface |
||
43 | */ |
||
44 | private $indexPage; |
||
45 | |||
46 | /** |
||
47 | * @var UpdatePageInterface |
||
48 | */ |
||
49 | private $updatePage; |
||
50 | |||
51 | /** |
||
52 | * @var CurrentPageResolverInterface |
||
53 | */ |
||
54 | private $currentPageResolver; |
||
55 | |||
56 | /** |
||
57 | * @var NotificationCheckerInterface |
||
58 | */ |
||
59 | private $notificationChecker; |
||
60 | |||
61 | /** |
||
62 | * @param CreatePageInterface $createPage |
||
63 | * @param GeneratePageInterface $generatePage |
||
64 | * @param IndexPageInterface $indexPage |
||
65 | * @param UpdatePageInterface $updatePage |
||
66 | * @param CurrentPageResolverInterface $currentPageResolver |
||
67 | * @param NotificationCheckerInterface $notificationChecker |
||
68 | */ |
||
69 | public function __construct( |
||
84 | |||
85 | /** |
||
86 | * @Given /^I want to view all coupons of (this promotion)$/ |
||
87 | * @Given /^I want to view all coupons of ("[^"]+" promotion)$/ |
||
88 | */ |
||
89 | public function iWantToViewAllCouponsOfThisPromotion(PromotionInterface $promotion) |
||
93 | |||
94 | /** |
||
95 | * @Given /^I want to create a new coupon for (this promotion)$/ |
||
96 | */ |
||
97 | public function iWantToCreateANewCouponForThisPromotion(PromotionInterface $promotion) |
||
101 | |||
102 | /** |
||
103 | * @Given /^I want to modify the ("[^"]+" coupon) for (this promotion)$/ |
||
104 | */ |
||
105 | public function iWantToModifyTheCoupon(CouponInterface $coupon, PromotionInterface $promotion) |
||
109 | |||
110 | /** |
||
111 | * @Given /^I want to generate a new coupons for (this promotion)$/ |
||
112 | */ |
||
113 | public function iWantToGenerateANewCouponsForThisPromotion(PromotionInterface $promotion) |
||
117 | |||
118 | /** |
||
119 | * @When /^I limit generated coupons usage to (\d+) times$/ |
||
120 | */ |
||
121 | public function iSetGeneratedCouponsUsageLimitTo($limit) |
||
125 | |||
126 | /** |
||
127 | * @When I make generated coupons valid until :date |
||
128 | */ |
||
129 | public function iMakeGeneratedCouponsValidUntil(\DateTime $date) |
||
133 | |||
134 | /** |
||
135 | * @When I specify its code as :code |
||
136 | */ |
||
137 | public function iSpecifyItsCodeAs($code) |
||
141 | |||
142 | /** |
||
143 | * @When I do not specify its code |
||
144 | */ |
||
145 | public function iDoNotSpecifyItsCode() |
||
149 | |||
150 | /** |
||
151 | * @When I do not specify its amount |
||
152 | */ |
||
153 | public function iDoNotSpecifyItsAmount() |
||
157 | |||
158 | /** |
||
159 | * @When I limit its usage to :limit times |
||
160 | */ |
||
161 | public function iLimitItsUsageLimitTo($limit) |
||
165 | |||
166 | /** |
||
167 | * @When I change its usage limit to :limit |
||
168 | */ |
||
169 | public function iChangeItsUsageLimitTo($limit) |
||
173 | |||
174 | /** |
||
175 | * @When I specify its amount as :amount |
||
176 | */ |
||
177 | public function iSpecifyItsAmountAs($amount) |
||
181 | |||
182 | /** |
||
183 | * @When I limit its per customer usage to :limit times |
||
184 | */ |
||
185 | public function iLimitItsPerCustomerUsageLimitTo($limit) |
||
189 | |||
190 | /** |
||
191 | * @When I change its per customer usage limit to :limit |
||
192 | */ |
||
193 | public function iChangeItsPerCustomerUsageLimitTo($limit) |
||
197 | |||
198 | /** |
||
199 | * @When I make it valid until :date |
||
200 | */ |
||
201 | public function iMakeItValidUntil(\DateTime $date) |
||
205 | |||
206 | /** |
||
207 | * @When I change expires date to :date |
||
208 | */ |
||
209 | public function iChangeExpiresDateTo(\DateTime $date) |
||
213 | |||
214 | /** |
||
215 | * @When I add it |
||
216 | * @When I try to add it |
||
217 | */ |
||
218 | public function iAddIt() |
||
222 | |||
223 | /** |
||
224 | * @When I save my changes |
||
225 | */ |
||
226 | public function iSaveMyChanges() |
||
230 | |||
231 | /** |
||
232 | * @When I generate it |
||
233 | * @When I try to generate it |
||
234 | */ |
||
235 | public function iGenerateIt() |
||
239 | |||
240 | /** |
||
241 | * @When /^I delete ("[^"]+" coupon) related to (this promotion)$/ |
||
242 | * @When /^I try to delete ("[^"]+" coupon) related to (this promotion)$/ |
||
243 | */ |
||
244 | public function iDeleteCouponRelatedToThisPromotion(CouponInterface $coupon, PromotionInterface $promotion) |
||
249 | |||
250 | /** |
||
251 | * @Then /^there should be (\d+) coupon related to (this promotion)$/ |
||
252 | */ |
||
253 | public function thereShouldBeCouponRelatedTo($number, PromotionInterface $promotion) |
||
263 | |||
264 | /** |
||
265 | * @Then /^there should be coupon with code "([^"]+)"$/ |
||
266 | */ |
||
267 | public function thereShouldBeCouponWithCode($code) |
||
274 | |||
275 | /** |
||
276 | * @Then this coupon should be valid until :date |
||
277 | */ |
||
278 | public function thisCouponShouldBeValidUntil(\DateTime $date) |
||
285 | |||
286 | /** |
||
287 | * @Then /^this coupon should have (\d+) usage limit$/ |
||
288 | */ |
||
289 | public function thisCouponShouldHaveUsageLimit($limit) |
||
296 | |||
297 | /** |
||
298 | * @Then /^this coupon should have (\d+) per customer usage limit$/ |
||
299 | */ |
||
300 | public function thisCouponShouldHavePerCustomerUsageLimit($limit) |
||
307 | |||
308 | /** |
||
309 | * @Then the code field should be disabled |
||
310 | */ |
||
311 | public function theCodeFieldShouldBeDisabled() |
||
318 | |||
319 | /** |
||
320 | * @Then /^I should be notified that coupon with this code already exists$/ |
||
321 | */ |
||
322 | public function iShouldBeNotifiedThatCouponWithThisCodeAlreadyExists() |
||
331 | |||
332 | /** |
||
333 | * @Then I should be notified that :element is required |
||
334 | */ |
||
335 | public function iShouldBeNotifiedThatIsRequired($element) |
||
344 | |||
345 | /** |
||
346 | * @Then I should be notified that generate amount is required |
||
347 | */ |
||
348 | public function iShouldBeNotifiedThatGenerateAmountIsRequired() |
||
355 | |||
356 | /** |
||
357 | * @Then /^there should still be only one coupon with code "([^"]+)" related to (this promotion)$/ |
||
358 | */ |
||
359 | public function thereShouldStillBeOnlyOneCouponWithCodeRelatedTo($code, PromotionInterface $promotion) |
||
368 | |||
369 | /** |
||
370 | * @Then I should be notified that coupon usage limit must be at least one |
||
371 | */ |
||
372 | public function iShouldBeNotifiedThatCouponUsageLimitMustBeAtLeast() |
||
381 | |||
382 | /** |
||
383 | * @Then /^(this coupon) should no longer exist in the coupon registry$/ |
||
384 | */ |
||
385 | public function couponShouldNotExistInTheRegistry(CouponInterface $coupon) |
||
392 | |||
393 | /** |
||
394 | * @Then I should be notified that it has been successfully generated |
||
395 | */ |
||
396 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyGenerated() |
||
400 | |||
401 | /** |
||
402 | * @Then I should be notified that it is in use and cannot be deleted |
||
403 | */ |
||
404 | public function iShouldBeNotifiedOfFailure() |
||
411 | |||
412 | /** |
||
413 | * @Then /^(this coupon) should still exist in the registry$/ |
||
414 | */ |
||
415 | public function couponShouldStillExistInTheRegistry(CouponInterface $coupon) |
||
422 | } |
||
423 |