1 | <?php |
||
28 | final class CartContext implements Context |
||
29 | { |
||
30 | /** |
||
31 | * @var SharedStorageInterface |
||
32 | */ |
||
33 | private $sharedStorage; |
||
34 | |||
35 | /** |
||
36 | * @var SummaryPageInterface |
||
37 | */ |
||
38 | private $summaryPage; |
||
39 | |||
40 | /** |
||
41 | * @var ShowPageInterface |
||
42 | */ |
||
43 | private $productShowPage; |
||
44 | |||
45 | /** |
||
46 | * @var NotificationCheckerInterface |
||
47 | */ |
||
48 | private $notificationChecker; |
||
49 | |||
50 | /** |
||
51 | * @param SharedStorageInterface $sharedStorage |
||
52 | * @param SummaryPageInterface $summaryPage |
||
53 | * @param ShowPageInterface $productShowPage |
||
54 | * @param NotificationCheckerInterface $notificationChecker |
||
55 | */ |
||
56 | public function __construct( |
||
67 | |||
68 | /** |
||
69 | * @When I see the summary of my cart |
||
70 | */ |
||
71 | public function iOpenCartSummaryPage() |
||
75 | |||
76 | /** |
||
77 | * @Then my cart should be empty |
||
78 | * @Then cart should be empty with no value |
||
79 | */ |
||
80 | public function iShouldBeNotifiedThatMyCartIsEmpty() |
||
89 | |||
90 | /** |
||
91 | * @Given /^I (?:remove|removed) product "([^"]+)" from the cart$/ |
||
92 | */ |
||
93 | public function iRemoveProductFromTheCart($productName) |
||
98 | |||
99 | /** |
||
100 | * @Given I change :productName quantity to :quantity |
||
101 | */ |
||
102 | public function iChangeQuantityTo($productName, $quantity) |
||
107 | |||
108 | /** |
||
109 | * @Then grand total value should be :total |
||
110 | * @Then my cart total should be :total |
||
111 | */ |
||
112 | public function myCartTotalShouldBe($total) |
||
121 | |||
122 | /** |
||
123 | * @Then tax total value should be :taxTotal |
||
124 | * @Then my cart taxes should be :taxTotal |
||
125 | */ |
||
126 | public function myCartTaxesShouldBe($taxTotal) |
||
136 | |||
137 | /** |
||
138 | * @Then shipping total value should be :shippingTotal |
||
139 | * @Then my cart shipping fee should be :shippingTotal |
||
140 | */ |
||
141 | public function myCartShippingFeeShouldBe($shippingTotal) |
||
151 | |||
152 | /** |
||
153 | * @Then my cart promotions should be :promotionsTotal |
||
154 | * @Then my discount should be :promotionsTotal |
||
155 | */ |
||
156 | public function myDiscountShouldBe($promotionsTotal) |
||
166 | |||
167 | /** |
||
168 | * @Given /^there should be no shipping fee$/ |
||
169 | */ |
||
170 | public function thereShouldBeNoShippingFee() |
||
176 | |||
177 | /** |
||
178 | * @Given /^there should be no discount$/ |
||
179 | */ |
||
180 | public function thereShouldBeNoDiscount() |
||
186 | |||
187 | /** |
||
188 | * @Then /^(its|theirs) price should be decreased by ("[^"]+")$/ |
||
189 | * @Then /^(product "[^"]+") price should be decreased by ("[^"]+")$/ |
||
190 | */ |
||
191 | public function itsPriceShouldBeDecreasedBy(ProductInterface $product, $amount) |
||
204 | |||
205 | /** |
||
206 | * @Given /^(product "[^"]+") price should not be decreased$/ |
||
207 | */ |
||
208 | public function productPriceShouldNotBeDecreased(ProductInterface $product) |
||
217 | |||
218 | |||
219 | /** |
||
220 | * @Given /^I add (this product) to the cart$/ |
||
221 | * @Given I added product :product to the cart |
||
222 | * @Given /^I (?:have|had) (product "([^"]+)") in the cart$/ |
||
223 | * @When I add product :product to the cart |
||
224 | */ |
||
225 | public function iAddProductToTheCart(ProductInterface $product) |
||
232 | |||
233 | /** |
||
234 | * @Given /^I added (products "([^"]+)" and "([^"]+)") to the cart$/ |
||
235 | * @When /^I add (products "([^"]+)" and "([^"]+)") to the cart$/ |
||
236 | * @Given /^I added (products "([^"]+)", "([^"]+)" and "([^"]+)") to the cart$/ |
||
237 | * @When /^I add (products "([^"]+)", "([^"]+)" and "([^"]+)") to the cart$/ |
||
238 | */ |
||
239 | public function iAddMultipleProductsToTheCart(array $products) |
||
245 | |||
246 | /** |
||
247 | * @Given I added :variant variant of product :product to the cart |
||
248 | * @When I add :variant variant of product :product to the cart |
||
249 | * @When I have :variant variant of product :product in the cart |
||
250 | * @When /^I add "([^"]+)" variant of (this product) to the cart$/ |
||
251 | */ |
||
252 | public function iAddProductToTheCartSelectingVariant($variant, ProductInterface $product) |
||
259 | |||
260 | /** |
||
261 | * @Given I have :quantity products :product in the cart |
||
262 | * @When I add :quantity products :product to the cart |
||
263 | */ |
||
264 | public function iAddProductsToTheCart(ProductInterface $product, $quantity) |
||
271 | |||
272 | /** |
||
273 | * @Then I should be on my cart summary page |
||
274 | */ |
||
275 | public function shouldBeOnMyCartSummaryPage() |
||
282 | |||
283 | /** |
||
284 | * @Then I should be notified that the product has been successfully added |
||
285 | */ |
||
286 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyAdded() |
||
290 | |||
291 | /** |
||
292 | * @Then there should be one item in my cart |
||
293 | */ |
||
294 | public function thereShouldBeOneItemInMyCart() |
||
301 | |||
302 | /** |
||
303 | * @Then this item should have name :itemName |
||
304 | */ |
||
305 | public function thisProductShouldHaveName($itemName) |
||
312 | |||
313 | /** |
||
314 | * @Then this item should have variant :variantName |
||
315 | */ |
||
316 | public function thisItemShouldHaveVariant($variantName) |
||
323 | |||
324 | /** |
||
325 | * @When /^I add (this product) with ([^"]+) "([^"]+)" to the cart$/ |
||
326 | */ |
||
327 | public function iAddThisProductWithSizeToTheCart(ProductInterface $product, $optionName, $optionValue) |
||
335 | |||
336 | /** |
||
337 | * @Given /^(this product) should have ([^"]+) "([^"]+)"$/ |
||
338 | */ |
||
339 | public function thisItemShouldHaveSize(ProductInterface $product, $optionName, $optionValue) |
||
347 | } |
||
348 |