1 | <?php |
||
18 | final class AddressingContext implements Context |
||
19 | { |
||
20 | /** |
||
21 | * @var SharedStorageInterface |
||
22 | */ |
||
23 | private $sharedStorage; |
||
24 | |||
25 | /** |
||
26 | * @var AddressPageInterface |
||
27 | */ |
||
28 | private $addressPage; |
||
29 | |||
30 | /** |
||
31 | * @var FactoryInterface |
||
32 | */ |
||
33 | private $addressFactory; |
||
34 | |||
35 | /** |
||
36 | * @var AddressComparatorInterface |
||
37 | */ |
||
38 | private $addressComparator; |
||
39 | |||
40 | /** |
||
41 | * @var SelectShippingPageInterface |
||
42 | */ |
||
43 | private $selectShippingPage; |
||
44 | |||
45 | /** |
||
46 | * @param SharedStorageInterface $sharedStorage |
||
47 | * @param AddressPageInterface $addressPage |
||
48 | * @param FactoryInterface $addressFactory |
||
49 | * @param AddressComparatorInterface $addressComparator |
||
50 | * @param SelectShippingPageInterface $selectShippingPage |
||
51 | */ |
||
52 | public function __construct( |
||
65 | |||
66 | /** |
||
67 | * @Given I am at the checkout addressing step |
||
68 | * @When I go back to addressing step of the checkout |
||
69 | */ |
||
70 | public function iAmAtTheCheckoutAddressingStep() |
||
74 | |||
75 | /** |
||
76 | * @When I try to open checkout addressing page |
||
77 | */ |
||
78 | public function iTryToOpenCheckoutAddressingPage() |
||
82 | |||
83 | /** |
||
84 | * @When /^I choose ("[^"]+" street) for shipping address$/ |
||
85 | */ |
||
86 | public function iChooseForShippingAddress(AddressInterface $address) |
||
90 | |||
91 | /** |
||
92 | * @When /^I choose ("[^"]+" street) for billing address$/ |
||
93 | */ |
||
94 | public function iChooseForBillingAddress(AddressInterface $address) |
||
99 | |||
100 | /** |
||
101 | * @When /^I specify the shipping (address as "[^"]+", "[^"]+", "[^"]+", "[^"]+" for "[^"]+")$/ |
||
102 | * @When /^I specify the shipping (address for "[^"]+" from "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+")$/ |
||
103 | * @When /^I (do not specify any shipping address) information$/ |
||
104 | * @When /^I change the shipping (address to "[^"]+", "[^"]+", "[^"]+", "[^"]+" for "[^"]+")$/ |
||
105 | */ |
||
106 | public function iSpecifyTheShippingAddressAs(AddressInterface $address) |
||
117 | |||
118 | /** |
||
119 | * @When I specify shipping country province as :province |
||
120 | */ |
||
121 | public function iSpecifyShippingCountryProvinceAs($province) |
||
125 | |||
126 | /** |
||
127 | * @When I specify billing country province as :province |
||
128 | */ |
||
129 | public function iSpecifyBillingCountryProvinceAs($province) |
||
133 | |||
134 | /** |
||
135 | * @When /^I specify the billing (address as "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)" for "([^"]+)")$/ |
||
136 | * @When /^I specify the billing (address for "([^"]+)" from "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)")$/ |
||
137 | * @When /^I (do not specify any billing address) information$/ |
||
138 | */ |
||
139 | public function iSpecifyTheBillingAddressAs(AddressInterface $address) |
||
152 | |||
153 | /** |
||
154 | * @When /^I specified the shipping (address as "[^"]+", "[^"]+", "[^"]+", "[^"]+" for "[^"]+")$/ |
||
155 | */ |
||
156 | public function iSpecifiedTheShippingAddress(AddressInterface $address) |
||
166 | |||
167 | /** |
||
168 | * @When I specify the email as :email |
||
169 | * @When I do not specify the email |
||
170 | */ |
||
171 | public function iSpecifyTheEmail($email = null) |
||
175 | |||
176 | /** |
||
177 | * @Then I should have :countryName selected as country |
||
178 | */ |
||
179 | public function iShouldHaveSelectedAsCountry($countryName) |
||
183 | |||
184 | /** |
||
185 | * @Then I should have no country selected |
||
186 | */ |
||
187 | public function iShouldHaveNoCountrySelected() |
||
191 | |||
192 | /** |
||
193 | * @When I complete the addressing step |
||
194 | * @When I try to complete the addressing step |
||
195 | */ |
||
196 | public function iCompleteTheAddressingStep() |
||
200 | |||
201 | /** |
||
202 | * @When I go back to store |
||
203 | */ |
||
204 | public function iGoBackToStore() |
||
208 | |||
209 | /** |
||
210 | * @When /^I proceed selecting ("[^"]+" as shipping country)$/ |
||
211 | */ |
||
212 | public function iProceedSelectingShippingCountry(CountryInterface $shippingCountry = null) |
||
223 | |||
224 | /** |
||
225 | * @When /^I proceed as guest "([^"]*)" with ("[^"]+" as shipping country)$/ |
||
226 | */ |
||
227 | public function iProceedLoggingAsGuestWithAsShippingCountry($email, CountryInterface $shippingCountry = null) |
||
239 | |||
240 | /** |
||
241 | * @When I specify the password as :password |
||
242 | */ |
||
243 | public function iSpecifyThePasswordAs($password) |
||
247 | |||
248 | /** |
||
249 | * @When I sign in |
||
250 | */ |
||
251 | public function iSignIn() |
||
255 | |||
256 | /** |
||
257 | * @Then I should be able to log in |
||
258 | */ |
||
259 | public function iShouldBeAbleToLogIn() |
||
263 | |||
264 | /** |
||
265 | * @Then the login form should no longer be accessible |
||
266 | */ |
||
267 | public function theLoginFormShouldNoLongerBeAccessible() |
||
271 | |||
272 | /** |
||
273 | * @Then I should be notified about bad credentials |
||
274 | */ |
||
275 | public function iShouldBeNotifiedAboutBadCredentials() |
||
279 | |||
280 | /** |
||
281 | * @Then I should be redirected to the addressing step |
||
282 | */ |
||
283 | public function iShouldBeRedirectedToTheAddressingStep() |
||
287 | |||
288 | /** |
||
289 | * @Then I should be able to go to the shipping step again |
||
290 | */ |
||
291 | public function iShouldBeAbleToGoToTheShippingStepAgain() |
||
297 | |||
298 | /** |
||
299 | * @Given /^I have completed addressing step with email "([^"]+)" and ("[^"]+" based shipping address)$/ |
||
300 | * @When /^I complete addressing step with email "([^"]+)" and ("[^"]+" based shipping address)$/ |
||
301 | */ |
||
302 | public function iCompleteAddressingStepWithEmail($email, AddressInterface $address) |
||
309 | |||
310 | /** |
||
311 | * @Then I should be on the checkout addressing step |
||
312 | */ |
||
313 | public function iShouldBeOnTheCheckoutAddressingStep() |
||
320 | |||
321 | /** |
||
322 | * @When I specify the province name manually as :provinceName for shipping address |
||
323 | */ |
||
324 | public function iSpecifyTheProvinceNameManuallyAsForShippingAddress($provinceName) |
||
328 | |||
329 | /** |
||
330 | * @When I specify the province name manually as :provinceName for billing address |
||
331 | */ |
||
332 | public function iSpecifyTheProvinceNameManuallyAsForBillingAddress($provinceName) |
||
336 | |||
337 | /** |
||
338 | * @Then I should not be able to specify province name manually for shipping address |
||
339 | */ |
||
340 | public function iShouldNotBeAbleToSpecifyProvinceNameManuallyForShippingAddress() |
||
347 | |||
348 | /** |
||
349 | * @Then I should not be able to specify province name manually for billing address |
||
350 | */ |
||
351 | public function iShouldNotBeAbleToSpecifyProvinceNameManuallyForBillingAddress() |
||
358 | |||
359 | /** |
||
360 | * @Then /^(address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+") should be filled as shipping address$/ |
||
361 | */ |
||
362 | public function addressShouldBeFilledAsShippingAddress(AddressInterface $address) |
||
366 | |||
367 | /** |
||
368 | * @Then /^(address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+") should be filled as billing address$/ |
||
369 | */ |
||
370 | public function addressShouldBeFilledAsBillingAddress(AddressInterface $address) |
||
374 | |||
375 | /** |
||
376 | * @Then /^I should(?:| also) be notified that the "([^"]+)" and the "([^"]+)" in (shipping|billing) details are required$/ |
||
377 | */ |
||
378 | public function iShouldBeNotifiedThatTheAndTheInShippingDetailsAreRequired($firstElement, $secondElement, $type) |
||
383 | |||
384 | /** |
||
385 | * @return AddressInterface |
||
386 | */ |
||
387 | private function createDefaultAddress() |
||
401 | |||
402 | /** |
||
403 | * @param string $type |
||
404 | * @param string $element |
||
405 | * @param string $expectedMessage |
||
406 | * |
||
407 | * @throws \InvalidArgumentException |
||
408 | */ |
||
409 | private function assertElementValidationMessage($type, $element, $expectedMessage) |
||
417 | } |
||
418 |