Complex classes like CheckoutContext often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use CheckoutContext, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
41 | final class CheckoutContext implements Context |
||
42 | { |
||
43 | /** |
||
44 | * @var SharedStorageInterface |
||
45 | */ |
||
46 | private $sharedStorage; |
||
47 | |||
48 | /** |
||
49 | * @var HomePageInterface |
||
50 | */ |
||
51 | private $homePage; |
||
52 | |||
53 | /** |
||
54 | * @var AddressPageInterface |
||
55 | */ |
||
56 | private $addressPage; |
||
57 | |||
58 | /** |
||
59 | * @var SelectPaymentPageInterface |
||
60 | */ |
||
61 | private $selectPaymentPage; |
||
62 | |||
63 | /** |
||
64 | * @var ThankYouPageInterface |
||
65 | */ |
||
66 | private $thankYouPage; |
||
67 | |||
68 | /** |
||
69 | * @var SelectShippingPageInterface |
||
70 | */ |
||
71 | private $selectShippingPage; |
||
72 | |||
73 | /** |
||
74 | * @var CompletePageInterface |
||
75 | */ |
||
76 | private $completePage; |
||
77 | |||
78 | /** |
||
79 | * @var ShowPageInterface |
||
80 | */ |
||
81 | private $orderDetails; |
||
82 | |||
83 | /** |
||
84 | * @var OrderRepositoryInterface |
||
85 | */ |
||
86 | private $orderRepository; |
||
87 | |||
88 | /** |
||
89 | * @var FactoryInterface |
||
90 | */ |
||
91 | private $addressFactory; |
||
92 | |||
93 | /** |
||
94 | * @var CurrentPageResolverInterface |
||
95 | */ |
||
96 | private $currentPageResolver; |
||
97 | |||
98 | /** |
||
99 | * @var AddressComparatorInterface |
||
100 | */ |
||
101 | private $addressComparator; |
||
102 | |||
103 | /** |
||
104 | * @param SharedStorageInterface $sharedStorage |
||
105 | * @param HomePageInterface $homePage |
||
106 | * @param AddressPageInterface $addressPage |
||
107 | * @param SelectPaymentPageInterface $selectPaymentPage |
||
108 | * @param ThankYouPageInterface $thankYouPage |
||
109 | * @param SelectShippingPageInterface $selectShippingPage |
||
110 | * @param CompletePageInterface $completePage |
||
111 | * @param ShowPageInterface $orderDetails |
||
112 | * @param OrderRepositoryInterface $orderRepository |
||
113 | * @param FactoryInterface $addressFactory |
||
114 | * @param CurrentPageResolverInterface $currentPageResolver |
||
115 | * @param AddressComparatorInterface $addressComparator |
||
116 | */ |
||
117 | public function __construct( |
||
144 | |||
145 | /** |
||
146 | * @Given I was at the checkout summary step |
||
147 | */ |
||
148 | public function iWasAtTheCheckoutSummaryStep() |
||
153 | |||
154 | /** |
||
155 | * @Given /^I proceed without selecting shipping address$/ |
||
156 | */ |
||
157 | public function iProceedWithoutSelectingShippingAddress() |
||
162 | |||
163 | /** |
||
164 | * @Given I have proceeded selecting :shippingMethodName shipping method |
||
165 | */ |
||
166 | public function iHaveProceededSelectingShippingMethod($shippingMethodName) |
||
171 | |||
172 | /** |
||
173 | * @Given I am at the checkout addressing step |
||
174 | * @When I go back to addressing step of the checkout |
||
175 | */ |
||
176 | public function iAmAtTheCheckoutAddressingStep() |
||
180 | |||
181 | /** |
||
182 | * @When I try to open checkout addressing page |
||
183 | */ |
||
184 | public function iTryToOpenCheckoutAddressingPage() |
||
188 | |||
189 | /** |
||
190 | * @When I try to open checkout shipping page |
||
191 | */ |
||
192 | public function iTryToOpenCheckoutShippingPage() |
||
196 | |||
197 | /** |
||
198 | * @When I try to open checkout payment page |
||
199 | */ |
||
200 | public function iTryToOpenCheckoutPaymentPage() |
||
204 | |||
205 | /** |
||
206 | * @When I try to open checkout complete page |
||
207 | */ |
||
208 | public function iTryToOpenCheckoutCompletePage() |
||
212 | |||
213 | /** |
||
214 | * @When /^I want to browse order details for (this order)$/ |
||
215 | */ |
||
216 | public function iWantToBrowseOrderDetailsForThisOrder(OrderInterface $order) |
||
220 | |||
221 | /** |
||
222 | * @When /^I choose ("[^"]+" street) for shipping address$/ |
||
223 | */ |
||
224 | public function iChooseForShippingAddress(AddressInterface $address) |
||
228 | |||
229 | /** |
||
230 | * @When /^I choose ("[^"]+" street) for billing address$/ |
||
231 | */ |
||
232 | public function iChooseForBillingAddress(AddressInterface $address) |
||
237 | |||
238 | /** |
||
239 | * @When /^I specify the shipping (address as "[^"]+", "[^"]+", "[^"]+", "[^"]+" for "[^"]+")$/ |
||
240 | * @When /^I specify the shipping (address for "[^"]+" from "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+")$/ |
||
241 | * @When /^I (do not specify any shipping address) information$/ |
||
242 | * @When /^I change the shipping (address to "[^"]+", "[^"]+", "[^"]+", "[^"]+" for "[^"]+")$/ |
||
243 | */ |
||
244 | public function iSpecifyTheShippingAddressAs(AddressInterface $address) |
||
255 | |||
256 | /** |
||
257 | * @When I specify shipping country province as :province |
||
258 | */ |
||
259 | public function iSpecifyShippingCountryProvinceAs($province) |
||
263 | |||
264 | /** |
||
265 | * @When I specify billing country province as :province |
||
266 | */ |
||
267 | public function iSpecifyBillingCountryProvinceAs($province) |
||
271 | |||
272 | /** |
||
273 | * @When /^I specify the billing (address as "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)" for "([^"]+)")$/ |
||
274 | * @When /^I specify the billing (address for "([^"]+)" from "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)")$/ |
||
275 | * @When /^I (do not specify any billing address) information$/ |
||
276 | */ |
||
277 | public function iSpecifyTheBillingAddressAs(AddressInterface $address) |
||
289 | |||
290 | /** |
||
291 | * @When /^I specified the shipping (address as "([^"]+)", "([^"]+)", "([^"]+)", "([^"]+)" for "([^"]+)")$/ |
||
292 | */ |
||
293 | public function iSpecifiedTheShippingAddress(AddressInterface $address) |
||
303 | |||
304 | /** |
||
305 | * @When I choose the different billing address |
||
306 | */ |
||
307 | public function iChooseTheDifferentBillingAddress() |
||
311 | |||
312 | /** |
||
313 | * @When I specify the email as :email |
||
314 | * @When I do not specify the email |
||
315 | */ |
||
316 | public function iSpecifyTheEmail($email = null) |
||
320 | |||
321 | /** |
||
322 | * @Given I have selected :shippingMethod shipping method |
||
323 | * @When I select :shippingMethod shipping method |
||
324 | */ |
||
325 | public function iSelectShippingMethod($shippingMethod) |
||
329 | |||
330 | /** |
||
331 | * @Then I should not be able to select :shippingMethodName shipping method |
||
332 | */ |
||
333 | public function iShouldNotBeAbleToSelectShippingMethod($shippingMethodName) |
||
340 | |||
341 | /** |
||
342 | * @Then I should have :shippingMethodName shipping method available as the first choice |
||
343 | */ |
||
344 | public function iShouldHaveShippingMethodAvailableAsFirstChoice($shippingMethodName) |
||
351 | |||
352 | /** |
||
353 | * @Then I should have :shippingMethodName shipping method available as the last choice |
||
354 | */ |
||
355 | public function iShouldHaveShippingMethodAvailableAsLastChoice($shippingMethodName) |
||
362 | |||
363 | /** |
||
364 | * @Then I should have :countryName selected as country |
||
365 | */ |
||
366 | public function iShouldHaveSelectedAsCountry($countryName) |
||
374 | |||
375 | /** |
||
376 | * @Then I should have no country selected |
||
377 | */ |
||
378 | public function iShouldHaveNoCountrySelected() |
||
386 | |||
387 | /** |
||
388 | * @When I complete the addressing step |
||
389 | * @When I try to complete the addressing step |
||
390 | */ |
||
391 | public function iCompleteTheAddressingStep() |
||
395 | |||
396 | /** |
||
397 | * @When I go back to store |
||
398 | */ |
||
399 | public function iGoBackToStore() |
||
403 | |||
404 | /** |
||
405 | * @When /^I(?:| try to) complete the shipping step$/ |
||
406 | */ |
||
407 | public function iCompleteTheShippingStep() |
||
411 | |||
412 | /** |
||
413 | * @When I decide to change my address |
||
414 | */ |
||
415 | public function iDecideToChangeMyAddress() |
||
419 | |||
420 | /** |
||
421 | * @When I decide to change order shipping method |
||
422 | */ |
||
423 | public function iDecideToChangeMyShippingMethod() |
||
427 | |||
428 | /** |
||
429 | * @When I want to browse thank you page |
||
430 | */ |
||
431 | public function iWantToBrowseThankYouPageForThisOrder() |
||
435 | |||
436 | /** |
||
437 | * @When I go to the addressing step |
||
438 | */ |
||
439 | public function iGoToTheAddressingStep() |
||
461 | |||
462 | /** |
||
463 | * @When I go to the shipping step |
||
464 | */ |
||
465 | public function iGoToTheShippingStep() |
||
481 | |||
482 | /** |
||
483 | * @When I decide to change the payment method |
||
484 | */ |
||
485 | public function iGoToThePaymentStep() |
||
489 | |||
490 | /** |
||
491 | * @When /^I proceed selecting ("[^"]+" as shipping country)$/ |
||
492 | */ |
||
493 | public function iProceedSelectingShippingCountry(CountryInterface $shippingCountry = null) |
||
504 | |||
505 | /** |
||
506 | * @When /^I proceed selecting ("[^"]+" as shipping country) with "([^"]+)" method$/ |
||
507 | */ |
||
508 | public function iProceedSelectingShippingCountryAndShippingMethod(CountryInterface $shippingCountry = null, $shippingMethodName) |
||
515 | |||
516 | /** |
||
517 | * @When /^I proceed selecting "([^"]+)" shipping method$/ |
||
518 | * @Given /^I chose "([^"]*)" shipping method$/ |
||
519 | */ |
||
520 | public function iProceedSelectingShippingMethod($shippingMethodName) |
||
524 | |||
525 | /** |
||
526 | * @When /^I choose "([^"]*)" payment method$/ |
||
527 | */ |
||
528 | public function iChoosePaymentMethod($paymentMethodName) |
||
533 | |||
534 | /** |
||
535 | * @When I change payment method to :paymentMethodName |
||
536 | */ |
||
537 | public function iChangePaymentMethodTo($paymentMethodName) |
||
541 | |||
542 | /** |
||
543 | * @When /^I proceed selecting "([^"]*)" as shipping country with "([^"]*)" payment method$/ |
||
544 | */ |
||
545 | public function iProceedSelectingShippingCountryAndPaymentMethod($shippingCountry, $paymentMethodName) |
||
551 | |||
552 | /** |
||
553 | * @When I go back to shipping step of the checkout |
||
554 | */ |
||
555 | public function iGoBackToShippingStepOfTheCheckout() |
||
559 | |||
560 | /** |
||
561 | * @Given I have proceeded selecting :paymentMethodName payment method |
||
562 | * @When /^I (?:proceed|proceeded) selecting "([^"]+)" payment method$/ |
||
563 | */ |
||
564 | public function iProceedSelectingPaymentMethod($paymentMethodName = 'Offline') |
||
568 | |||
569 | /** |
||
570 | * @When /^I change shipping method to "([^"]*)"$/ |
||
571 | */ |
||
572 | public function iChangeShippingMethod($shippingMethodName) |
||
578 | |||
579 | /** |
||
580 | * @When /^I provide additional note like "([^"]+)"$/ |
||
581 | */ |
||
582 | public function iProvideAdditionalNotesLike($notes) |
||
587 | |||
588 | /** |
||
589 | * @When /^I proceed as guest "([^"]*)" with ("[^"]+" as shipping country)$/ |
||
590 | */ |
||
591 | public function iProceedLoggingAsGuestWithAsShippingCountry($email, CountryInterface $shippingCountry = null) |
||
603 | |||
604 | /** |
||
605 | * @When I return to the checkout summary step |
||
606 | */ |
||
607 | public function iReturnToTheCheckoutSummaryStep() |
||
611 | |||
612 | /** |
||
613 | * @When I want to complete checkout |
||
614 | */ |
||
615 | public function iWantToCompleteCheckout() |
||
619 | |||
620 | /** |
||
621 | * @Given I have confirmed my order |
||
622 | * @When I confirm my order |
||
623 | */ |
||
624 | public function iConfirmMyOrder() |
||
628 | |||
629 | /** |
||
630 | * @When I specify the password as :password |
||
631 | */ |
||
632 | public function iSpecifyThePasswordAs($password) |
||
636 | |||
637 | /** |
||
638 | * @When I sign in |
||
639 | */ |
||
640 | public function iSignIn() |
||
644 | |||
645 | /** |
||
646 | * @Then I should see the thank you page |
||
647 | */ |
||
648 | public function iShouldSeeTheThankYouPage() |
||
655 | |||
656 | /** |
||
657 | * @Then I should not see the thank you page |
||
658 | */ |
||
659 | public function iShouldNotSeeTheThankYouPage() |
||
666 | |||
667 | /** |
||
668 | * @Given I should be informed with :paymentMethod payment method instructions |
||
669 | */ |
||
670 | public function iShouldBeInformedWithPaymentMethodInstructions(PaymentMethodInterface $paymentMethod) |
||
677 | |||
678 | /** |
||
679 | * @Then /^I should be redirected (?:|back )to the thank you page$/ |
||
680 | */ |
||
681 | public function iShouldBeRedirectedBackToTheThankYouPage() |
||
690 | |||
691 | /** |
||
692 | * @Then I should be on the checkout shipping step |
||
693 | */ |
||
694 | public function iShouldBeOnTheCheckoutShippingStep() |
||
701 | |||
702 | /** |
||
703 | * @Then I should be on the checkout payment step |
||
704 | */ |
||
705 | public function iShouldBeOnTheCheckoutPaymentStep() |
||
712 | |||
713 | /** |
||
714 | * @Then I should be on the checkout summary step |
||
715 | */ |
||
716 | public function iShouldBeOnTheCheckoutSummaryStep() |
||
723 | |||
724 | /** |
||
725 | * @Then /^I should(?:| also) be notified that the "([^"]+)" and the "([^"]+)" in (shipping|billing) details are required$/ |
||
726 | */ |
||
727 | public function iShouldBeNotifiedThatTheAndTheInShippingDetailsAreRequired($firstElement, $secondElement, $type) |
||
732 | |||
733 | /** |
||
734 | * @Then I should be informed that my order cannot be shipped to this address |
||
735 | */ |
||
736 | public function iShouldBeInformedThatMyOrderCannotBeShippedToThisAddress() |
||
743 | |||
744 | /** |
||
745 | * @Then I should be able to log in |
||
746 | */ |
||
747 | public function iShouldBeAbleToLogIn() |
||
754 | |||
755 | /** |
||
756 | * @Then the login form should no longer be accessible |
||
757 | */ |
||
758 | public function theLoginFormShouldNoLongerBeAccessible() |
||
765 | |||
766 | /** |
||
767 | * @Then I should be notified about bad credentials |
||
768 | */ |
||
769 | public function iShouldBeNotifiedAboutBadCredentials() |
||
776 | |||
777 | /** |
||
778 | * @Then my order's shipping address should be to :fullName |
||
779 | */ |
||
780 | public function iShouldSeeThisShippingAddressAsShippingAddress($fullName) |
||
788 | |||
789 | /** |
||
790 | * @Then my order's billing address should be to :fullName |
||
791 | */ |
||
792 | public function iShouldSeeThisBillingAddressAsBillingAddress($fullName) |
||
800 | |||
801 | /** |
||
802 | * @Then address to :fullName should be used for both shipping and billing of my order |
||
803 | */ |
||
804 | public function iShouldSeeThisShippingAddressAsShippingAndBillingAddress($fullName) |
||
809 | |||
810 | /** |
||
811 | * @Given I am at the checkout payment step |
||
812 | * @When I go back to payment step of the checkout |
||
813 | */ |
||
814 | public function iAmAtTheCheckoutPaymentStep() |
||
818 | |||
819 | /** |
||
820 | * @When I complete the payment step |
||
821 | */ |
||
822 | public function iCompleteThePaymentStep() |
||
826 | |||
827 | /** |
||
828 | * @When I select :name payment method |
||
829 | */ |
||
830 | public function iSelectPaymentMethod($name) |
||
834 | |||
835 | /** |
||
836 | * @When /^I do not modify anything$/ |
||
837 | */ |
||
838 | public function iDoNotModifyAnything() |
||
842 | |||
843 | /** |
||
844 | * @Then I should not be able to select :paymentMethodName payment method |
||
845 | */ |
||
846 | public function iShouldNotBeAbleToSelectPaymentMethod($paymentMethodName) |
||
853 | |||
854 | /** |
||
855 | * @Then I should be able to select :paymentMethodName payment method |
||
856 | */ |
||
857 | public function iShouldBeAbleToSelectPaymentMethod($paymentMethodName) |
||
864 | |||
865 | /** |
||
866 | * @Given I have proceeded order with :shippingMethod shipping method and :paymentMethod payment |
||
867 | * @When I proceed with :shippingMethod shipping method and :paymentMethod payment |
||
868 | */ |
||
869 | public function iProceedOrderWithShippingMethodAndPayment($shippingMethod, $paymentMethod) |
||
876 | |||
877 | /** |
||
878 | * @Given I should have :quantity :productName products in the cart |
||
879 | */ |
||
880 | public function iShouldHaveProductsInTheCart($quantity, $productName) |
||
887 | |||
888 | /** |
||
889 | * @Then my order shipping should be :price |
||
890 | */ |
||
891 | public function myOrderShippingShouldBe($price) |
||
898 | |||
899 | /** |
||
900 | * @Then /^the ("[^"]+" product) should have unit price discounted by ("\$\d+")$/ |
||
901 | */ |
||
902 | public function theShouldHaveUnitPriceDiscountedFor(ProductInterface $product, $amount) |
||
909 | |||
910 | /** |
||
911 | * @Then /^my order total should be ("(?:\£|\$)\d+")$/ |
||
912 | */ |
||
913 | public function myOrderTotalShouldBe($total) |
||
920 | |||
921 | /** |
||
922 | * @Then my order promotion total should be :promotionTotal |
||
923 | */ |
||
924 | public function myOrderPromotionTotalShouldBe($promotionTotal) |
||
931 | |||
932 | /** |
||
933 | * @Then :promotionName should be applied to my order |
||
934 | */ |
||
935 | public function shouldBeAppliedToMyOrder($promotionName) |
||
942 | |||
943 | /** |
||
944 | * @Given my tax total should be :taxTotal |
||
945 | */ |
||
946 | public function myTaxTotalShouldBe($taxTotal) |
||
953 | |||
954 | /** |
||
955 | * @Then my order's shipping method should be :shippingMethod |
||
956 | */ |
||
957 | public function myOrderSShippingMethodShouldBe(ShippingMethodInterface $shippingMethod) |
||
964 | |||
965 | /** |
||
966 | * @Then my order's payment method should be :paymentMethod |
||
967 | */ |
||
968 | public function myOrderSPaymentMethodShouldBe(PaymentMethodInterface $paymentMethod) |
||
975 | |||
976 | /** |
||
977 | * @Then I should be redirected to the homepage |
||
978 | */ |
||
979 | public function iShouldBeRedirectedToTheHomepage() |
||
986 | |||
987 | /** |
||
988 | * @Then I should be redirected to the addressing step |
||
989 | */ |
||
990 | public function iShouldBeRedirectedToTheAddressingStep() |
||
997 | |||
998 | /** |
||
999 | * @Given I should be able to go to the shipping step again |
||
1000 | */ |
||
1001 | public function iShouldBeAbleToGoToTheShippingStepAgain() |
||
1010 | |||
1011 | /** |
||
1012 | * @Then I should be redirected to the shipping step |
||
1013 | */ |
||
1014 | public function iShouldBeRedirectedToTheShippingStep() |
||
1021 | |||
1022 | /** |
||
1023 | * @Then /^I should be able to pay(?| again)$/ |
||
1024 | */ |
||
1025 | public function iShouldBeAbleToPayAgain() |
||
1032 | |||
1033 | /** |
||
1034 | * @Then I should not be able to pay |
||
1035 | */ |
||
1036 | public function iShouldNotBeAbleToPayAgain() |
||
1043 | |||
1044 | /** |
||
1045 | * @Given I should be able to go to the payment step again |
||
1046 | */ |
||
1047 | public function iShouldBeAbleToGoToThePaymentStepAgain() |
||
1056 | |||
1057 | /** |
||
1058 | * @Then I should be redirected to the payment step |
||
1059 | */ |
||
1060 | public function iShouldBeRedirectedToThePaymentStep() |
||
1067 | |||
1068 | /** |
||
1069 | * @Given I should be able to go to the summary page again |
||
1070 | */ |
||
1071 | public function iShouldBeAbleToGoToTheSummaryPageAgain() |
||
1080 | |||
1081 | /** |
||
1082 | * @Given I should see shipping method :shippingMethodName with fee :fee |
||
1083 | */ |
||
1084 | public function iShouldSeeShippingFee($shippingMethodName, $fee) |
||
1091 | |||
1092 | /** |
||
1093 | * @Given /^I have completed addressing step with email "([^"]+)" and ("[^"]+" based shipping address)$/ |
||
1094 | * @When /^I complete addressing step with email "([^"]+)" and ("[^"]+" based shipping address)$/ |
||
1095 | */ |
||
1096 | public function iCompleteAddressingStepWithEmail($email, AddressInterface $address) |
||
1103 | |||
1104 | /** |
||
1105 | * @Then the subtotal of :item item should be :price |
||
1106 | */ |
||
1107 | public function theSubtotalOfItemShouldBe($item, $price) |
||
1118 | |||
1119 | /** |
||
1120 | * @Then the :product product should have unit price :price |
||
1121 | */ |
||
1122 | public function theProductShouldHaveUnitPrice(ProductInterface $product, $price) |
||
1129 | |||
1130 | /** |
||
1131 | * @Given /^I should be notified that (this product) does not have sufficient stock$/ |
||
1132 | */ |
||
1133 | public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product) |
||
1140 | |||
1141 | /** |
||
1142 | * @Then my order's locale should be :localeName |
||
1143 | */ |
||
1144 | public function myOrderSLocaleShouldBe($localeName) |
||
1151 | |||
1152 | /** |
||
1153 | * @Then my order's currency should be :currencyCode |
||
1154 | */ |
||
1155 | public function myOrderSCurrencyShouldBe($currencyCode) |
||
1162 | |||
1163 | /** |
||
1164 | * @Then /^I should not be notified that (this product) does not have sufficient stock$/ |
||
1165 | */ |
||
1166 | public function iShouldNotBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product) |
||
1173 | |||
1174 | /** |
||
1175 | * @Then I should be on the checkout addressing step |
||
1176 | */ |
||
1177 | public function iShouldBeOnTheCheckoutAddressingStep() |
||
1184 | |||
1185 | /** |
||
1186 | * @When I specify the province name manually as :provinceName for shipping address |
||
1187 | */ |
||
1188 | public function iSpecifyTheProvinceNameManuallyAsForShippingAddress($provinceName) |
||
1192 | |||
1193 | /** |
||
1194 | * @When I specify the province name manually as :provinceName for billing address |
||
1195 | */ |
||
1196 | public function iSpecifyTheProvinceNameManuallyAsForBillingAddress($provinceName) |
||
1200 | |||
1201 | /** |
||
1202 | * @Then I should not be able to specify province name manually for shipping address |
||
1203 | */ |
||
1204 | public function iShouldNotBeAbleToSpecifyProvinceNameManuallyForShippingAddress() |
||
1211 | |||
1212 | /** |
||
1213 | * @Then I should not be able to specify province name manually for billing address |
||
1214 | */ |
||
1215 | public function iShouldNotBeAbleToSpecifyProvinceNameManuallyForBillingAddress() |
||
1222 | |||
1223 | /** |
||
1224 | * @Then I should see :provinceName in the shipping address |
||
1225 | */ |
||
1226 | public function iShouldSeeInTheShippingAddress($provinceName) |
||
1233 | |||
1234 | /** |
||
1235 | * @Then I should see :provinceName in the billing address |
||
1236 | */ |
||
1237 | public function iShouldSeeInTheBillingAddress($provinceName) |
||
1244 | |||
1245 | /** |
||
1246 | * @When I do not select any shipping method |
||
1247 | */ |
||
1248 | public function iDoNotSelectAnyShippingMethod() |
||
1252 | |||
1253 | /** |
||
1254 | * @Then I should still be on the shipping step |
||
1255 | */ |
||
1256 | public function iShouldStillBeOnTheShippingStep() |
||
1263 | |||
1264 | /** |
||
1265 | * @Then I should be notified that the shipping method is required |
||
1266 | */ |
||
1267 | public function iShouldBeNotifiedThatTheShippingMethodIsRequired() |
||
1274 | |||
1275 | /** |
||
1276 | * @Then there should be information about no available shipping methods |
||
1277 | * @Then there should be information about no shipping methods available for my shipping address |
||
1278 | */ |
||
1279 | public function thereShouldBeInformationAboutNoShippingMethodsAvailableForMyShippingAddress() |
||
1286 | |||
1287 | /** |
||
1288 | * @Then I should not be able to complete the shipping step |
||
1289 | */ |
||
1290 | public function iShouldNotBeAbleToCompleteTheShippingStep() |
||
1297 | |||
1298 | /** |
||
1299 | * @When I do not select any payment method |
||
1300 | */ |
||
1301 | public function iDoNotSelectAnyPaymentMethod() |
||
1305 | |||
1306 | /** |
||
1307 | * @Then I should not be able to complete the payment step |
||
1308 | */ |
||
1309 | public function iShouldNotBeAbleToCompleteThePaymentStep() |
||
1316 | |||
1317 | /** |
||
1318 | * @Then there should be information about no payment methods available for my order |
||
1319 | */ |
||
1320 | public function thereShouldBeInformationAboutNoPaymentMethodsAvailableForMyOrder() |
||
1327 | |||
1328 | /** |
||
1329 | * @Then /^(address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+") should be filled as shipping address$/ |
||
1330 | */ |
||
1331 | public function addressShouldBeFilledAsShippingAddress(AddressInterface $address) |
||
1335 | |||
1336 | /** |
||
1337 | * @Then /^(address "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+", "[^"]+") should be filled as billing address$/ |
||
1338 | */ |
||
1339 | public function addressShouldBeFilledAsBillingAddress(AddressInterface $address) |
||
1343 | |||
1344 | /** |
||
1345 | * @Then I should have :paymentMethodName payment method available as the first choice |
||
1346 | */ |
||
1347 | public function iShouldHavePaymentMethodAvailableAsFirstChoice($paymentMethodName) |
||
1354 | |||
1355 | /** |
||
1356 | * @Then I should have :paymentMethodName payment method available as the last choice |
||
1357 | */ |
||
1358 | public function iShouldHavePaymentMethodAvailableAsLastChoice($paymentMethodName) |
||
1365 | |||
1366 | /** |
||
1367 | * @Then I should see :shippingMethodName shipping method |
||
1368 | */ |
||
1369 | public function iShouldSeeShippingMethod($shippingMethodName) |
||
1376 | |||
1377 | /** |
||
1378 | * @Then I should not see :shippingMethodName shipping method |
||
1379 | */ |
||
1380 | public function iShouldNotSeeShippingMethod($shippingMethodName) |
||
1387 | |||
1388 | /** |
||
1389 | * @return AddressInterface |
||
1390 | */ |
||
1391 | private function createDefaultAddress() |
||
1405 | |||
1406 | /** |
||
1407 | * @param string $type |
||
1408 | * @param string $element |
||
1409 | * @param string $expectedMessage |
||
1410 | * |
||
1411 | * @throws \InvalidArgumentException |
||
1412 | */ |
||
1413 | private function assertElementValidationMessage($type, $element, $expectedMessage) |
||
1421 | |||
1422 | /** |
||
1423 | * @return SymfonyPageInterface |
||
1424 | */ |
||
1425 | private function resolveCurrentStepPage() |
||
1435 | } |
||
1436 |
If you place a parameter with a default value before a parameter with a default value, the default value of the first parameter will never be used as it will always need to be passed anyway: