Complex classes like ManagingProductsContext 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 ManagingProductsContext, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
36 | final class ManagingProductsContext implements Context |
||
37 | { |
||
38 | /** |
||
39 | * @var SharedStorageInterface |
||
40 | */ |
||
41 | private $sharedStorage; |
||
42 | |||
43 | /** |
||
44 | * @var CreateSimpleProductPageInterface |
||
45 | */ |
||
46 | private $createSimpleProductPage; |
||
47 | |||
48 | /** |
||
49 | * @var CreateConfigurableProductPageInterface |
||
50 | */ |
||
51 | private $createConfigurableProductPage; |
||
52 | |||
53 | /** |
||
54 | * @var IndexPageInterface |
||
55 | */ |
||
56 | private $indexPage; |
||
57 | |||
58 | /** |
||
59 | * @var UpdateSimpleProductPageInterface |
||
60 | */ |
||
61 | private $updateSimpleProductPage; |
||
62 | |||
63 | /** |
||
64 | * @var UpdateConfigurableProductPageInterface |
||
65 | */ |
||
66 | private $updateConfigurableProductPage; |
||
67 | |||
68 | /** |
||
69 | * @var ProductReviewIndexPageInterface |
||
70 | */ |
||
71 | private $productReviewIndexPage; |
||
72 | |||
73 | /** |
||
74 | * @var IndexPerTaxonPageInterface |
||
75 | */ |
||
76 | private $indexPerTaxonPage; |
||
77 | |||
78 | /** |
||
79 | * @var CurrentPageResolverInterface |
||
80 | */ |
||
81 | private $currentPageResolver; |
||
82 | |||
83 | /** |
||
84 | * @var NotificationCheckerInterface |
||
85 | */ |
||
86 | private $notificationChecker; |
||
87 | |||
88 | /** |
||
89 | * @param SharedStorageInterface $sharedStorage |
||
90 | * @param CreateSimpleProductPageInterface $createSimpleProductPage |
||
91 | * @param CreateConfigurableProductPageInterface $createConfigurableProductPage |
||
92 | * @param IndexPageInterface $indexPage |
||
93 | * @param UpdateSimpleProductPageInterface $updateSimpleProductPage |
||
94 | * @param UpdateConfigurableProductPageInterface $updateConfigurableProductPage |
||
95 | * @param ProductReviewIndexPageInterface $productReviewIndexPage |
||
96 | * @param IndexPerTaxonPageInterface $indexPerTaxonPage |
||
97 | * @param CurrentPageResolverInterface $currentPageResolver |
||
98 | * @param NotificationCheckerInterface $notificationChecker |
||
99 | */ |
||
100 | public function __construct( |
||
101 | SharedStorageInterface $sharedStorage, |
||
102 | CreateSimpleProductPageInterface $createSimpleProductPage, |
||
103 | CreateConfigurableProductPageInterface $createConfigurableProductPage, |
||
104 | IndexPageInterface $indexPage, |
||
105 | UpdateSimpleProductPageInterface $updateSimpleProductPage, |
||
106 | UpdateConfigurableProductPageInterface $updateConfigurableProductPage, |
||
107 | ProductReviewIndexPageInterface $productReviewIndexPage, |
||
108 | IndexPerTaxonPageInterface $indexPerTaxonPage, |
||
109 | CurrentPageResolverInterface $currentPageResolver, |
||
110 | NotificationCheckerInterface $notificationChecker |
||
111 | ) { |
||
112 | $this->sharedStorage = $sharedStorage; |
||
113 | $this->createSimpleProductPage = $createSimpleProductPage; |
||
114 | $this->createConfigurableProductPage = $createConfigurableProductPage; |
||
115 | $this->indexPage = $indexPage; |
||
116 | $this->updateSimpleProductPage = $updateSimpleProductPage; |
||
117 | $this->updateConfigurableProductPage = $updateConfigurableProductPage; |
||
118 | $this->productReviewIndexPage = $productReviewIndexPage; |
||
119 | $this->indexPerTaxonPage = $indexPerTaxonPage; |
||
120 | $this->currentPageResolver = $currentPageResolver; |
||
121 | $this->notificationChecker = $notificationChecker; |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * @Given I want to create a new simple product |
||
126 | */ |
||
127 | public function iWantToCreateANewSimpleProduct() |
||
128 | { |
||
129 | $this->createSimpleProductPage->open(); |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * @Given I want to create a new configurable product |
||
134 | */ |
||
135 | public function iWantToCreateANewConfigurableProduct() |
||
136 | { |
||
137 | $this->createConfigurableProductPage->open(); |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * @When I specify its code as :code |
||
142 | * @When I do not specify its code |
||
143 | */ |
||
144 | public function iSpecifyItsCodeAs($code = null) |
||
145 | { |
||
146 | $currentPage = $this->resolveCurrentPage(); |
||
147 | |||
148 | $currentPage->specifyCode($code); |
||
|
|||
149 | } |
||
150 | |||
151 | /** |
||
152 | * @When I name it :name in :language |
||
153 | * @When I rename it to :name in :language |
||
154 | */ |
||
155 | public function iRenameItToIn($name, $language) |
||
156 | { |
||
157 | $currentPage = $this->resolveCurrentPage(); |
||
158 | |||
159 | $currentPage->nameItIn($name, $language); |
||
160 | } |
||
161 | |||
162 | /** |
||
163 | * @When I add it |
||
164 | * @When I try to add it |
||
165 | */ |
||
166 | public function iAddIt() |
||
167 | { |
||
168 | /** @var CreatePageInterface $currentPage */ |
||
169 | $currentPage = $this->resolveCurrentPage(); |
||
170 | |||
171 | $currentPage->create(); |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * @When I disable its inventory tracking |
||
176 | */ |
||
177 | public function iDisableItsTracking() |
||
178 | { |
||
179 | $this->updateSimpleProductPage->disableTracking(); |
||
180 | } |
||
181 | |||
182 | /** |
||
183 | * @When I enable its inventory tracking |
||
184 | */ |
||
185 | public function iEnableItsTracking() |
||
186 | { |
||
187 | $this->updateSimpleProductPage->enableTracking(); |
||
188 | } |
||
189 | |||
190 | /** |
||
191 | * @When /^I set its(?:| default) price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ |
||
192 | */ |
||
193 | public function iSetItsPriceTo($price, $channelName) |
||
194 | { |
||
195 | $this->createSimpleProductPage->specifyPrice($channelName, $price); |
||
196 | } |
||
197 | |||
198 | /** |
||
199 | * @When /^I set its original price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ |
||
200 | */ |
||
201 | public function iSetItsOriginalPriceTo($originalPrice, $channelName) |
||
202 | { |
||
203 | $this->createSimpleProductPage->specifyOriginalPrice($channelName, $originalPrice); |
||
204 | } |
||
205 | |||
206 | /** |
||
207 | * @When I make it available in channel :channel |
||
208 | */ |
||
209 | public function iMakeItAvailableInChannel($channel) |
||
210 | { |
||
211 | $this->createSimpleProductPage->checkChannel($channel); |
||
212 | } |
||
213 | |||
214 | /** |
||
215 | * @When I assign it to channel :channel |
||
216 | */ |
||
217 | public function iAssignItToChannel($channel) |
||
218 | { |
||
219 | // Temporary solution until we will make current page resolver work with product pages |
||
220 | $this->updateConfigurableProductPage->checkChannel($channel); |
||
221 | } |
||
222 | |||
223 | /** |
||
224 | * @When I choose :calculatorName calculator |
||
225 | */ |
||
226 | public function iChooseCalculator($calculatorName) |
||
227 | { |
||
228 | $this->createSimpleProductPage->choosePricingCalculator($calculatorName); |
||
229 | } |
||
230 | |||
231 | /** |
||
232 | * @When I set its slug to :slug |
||
233 | * @When I set its slug to :slug in :language |
||
234 | * @When I remove its slug |
||
235 | */ |
||
236 | public function iSetItsSlugToIn($slug = null, $language = 'en_US') |
||
237 | { |
||
238 | $this->createSimpleProductPage->specifySlugIn($slug, $language); |
||
239 | } |
||
240 | |||
241 | /** |
||
242 | * @When I enable slug modification |
||
243 | * @When I enable slug modification in :localeCode |
||
244 | */ |
||
245 | public function iEnableSlugModification($localeCode = 'en_US') |
||
246 | { |
||
247 | $this->updateSimpleProductPage->activateLanguageTab($localeCode); |
||
248 | $this->updateSimpleProductPage->enableSlugModification($localeCode); |
||
249 | } |
||
250 | |||
251 | /** |
||
252 | * @Then I should see the product :productName in the list |
||
253 | * @Then the product :productName should appear in the store |
||
254 | * @Then the product :productName should be in the shop |
||
255 | * @Then this product should still be named :productName |
||
256 | */ |
||
257 | public function theProductShouldAppearInTheShop(string $productName): void |
||
263 | |||
264 | /** |
||
265 | * @Given I am browsing products |
||
266 | * @When I browse products |
||
267 | * @When I want to browse products |
||
268 | */ |
||
269 | public function iWantToBrowseProducts() |
||
270 | { |
||
271 | $this->indexPage->open(); |
||
272 | } |
||
273 | |||
274 | /** |
||
275 | * @When /^I am browsing products from ("([^"]+)" taxon)$/ |
||
276 | */ |
||
277 | public function iAmBrowsingProductsFromTaxon(TaxonInterface $taxon) |
||
278 | { |
||
279 | $this->indexPerTaxonPage->open(['taxonId' => $taxon->getId()]); |
||
281 | |||
282 | /** |
||
283 | * @When I filter them by :taxonName taxon |
||
284 | */ |
||
285 | public function iFilterThemByTaxon($taxonName) |
||
289 | |||
290 | /** |
||
291 | * @When I check (also) the :productName product |
||
292 | */ |
||
293 | public function iCheckTheProduct(string $productName): void |
||
297 | |||
298 | /** |
||
299 | * @When I delete them |
||
300 | */ |
||
301 | public function iDeleteThem(): void |
||
305 | |||
306 | /** |
||
307 | * @Then I should( still) see a product with :field :value |
||
308 | */ |
||
309 | public function iShouldSeeProductWith($field, $value) |
||
313 | |||
314 | /** |
||
315 | * @Then I should not see any product with :field :value |
||
316 | */ |
||
317 | public function iShouldNotSeeAnyProductWith($field, $value) |
||
321 | |||
322 | /** |
||
323 | * @Then the first product on the list should have :field :value |
||
324 | */ |
||
325 | public function theFirstProductOnTheListShouldHave($field, $value) |
||
331 | |||
332 | /** |
||
333 | * @Then the last product on the list should have :field :value |
||
334 | */ |
||
335 | public function theLastProductOnTheListShouldHave($field, $value) |
||
341 | |||
342 | /** |
||
343 | * @When I switch the way products are sorted by :field |
||
344 | * @When I start sorting products by :field |
||
345 | * @Given the products are already sorted by :field |
||
346 | */ |
||
347 | public function iSortProductsBy($field) |
||
351 | |||
352 | /** |
||
353 | * @Then I should see a single product in the list |
||
354 | * @Then I should see :numberOfProducts products in the list |
||
355 | */ |
||
356 | public function iShouldSeeProductsInTheList(int $numberOfProducts = 1): void |
||
360 | |||
361 | /** |
||
362 | * @When I delete the :product product |
||
363 | * @When I try to delete the :product product |
||
364 | */ |
||
365 | public function iDeleteProduct(ProductInterface $product) |
||
372 | |||
373 | /** |
||
374 | * @Then /^(this product) should not exist in the product catalog$/ |
||
375 | */ |
||
376 | public function productShouldNotExist(ProductInterface $product) |
||
382 | |||
383 | /** |
||
384 | * @Then I should be notified that this product is in use and cannot be deleted |
||
385 | */ |
||
386 | public function iShouldBeNotifiedOfFailure() |
||
393 | |||
394 | /** |
||
395 | * @Then /^(this product) should still exist in the product catalog$/ |
||
396 | */ |
||
397 | public function productShouldExistInTheProductCatalog(ProductInterface $product) |
||
401 | |||
402 | /** |
||
403 | * @When I want to modify the :product product |
||
404 | * @When /^I want to modify (this product)$/ |
||
405 | */ |
||
406 | public function iWantToModifyAProduct(ProductInterface $product) |
||
418 | |||
419 | /** |
||
420 | * @Then the code field should be disabled |
||
421 | */ |
||
422 | public function theCodeFieldShouldBeDisabled() |
||
428 | |||
429 | /** |
||
430 | * @Then the slug field should not be editable |
||
431 | * @Then the slug field in :localeCode (also )should not be editable |
||
432 | */ |
||
433 | public function theSlugFieldShouldNotBeEditable($localeCode = 'en_US') |
||
437 | |||
438 | /** |
||
439 | * @Then this product name should be :name |
||
440 | */ |
||
441 | public function thisProductElementShouldBe($name) |
||
445 | |||
446 | /** |
||
447 | * @Then /^I should be notified that (code|name|slug) is required$/ |
||
448 | */ |
||
449 | public function iShouldBeNotifiedThatIsRequired($element) |
||
453 | |||
454 | /** |
||
455 | * @When I save my changes |
||
456 | * @When I try to save my changes |
||
457 | */ |
||
458 | public function iSaveMyChanges() |
||
464 | |||
465 | /** |
||
466 | * @When /^I change its price to (?:€|£|\$)([^"]+) for "([^"]+)" channel$/ |
||
467 | */ |
||
468 | public function iChangeItsPriceTo($price, $channelName) |
||
472 | |||
473 | /** |
||
474 | * @When /^I change its original price to "(?:€|£|\$)([^"]+)" for "([^"]+)" channel$/ |
||
475 | */ |
||
476 | public function iChangeItsOriginalPriceTo($price, $channelName) |
||
480 | |||
481 | /** |
||
482 | * @Given I add the :optionName option to it |
||
483 | */ |
||
484 | public function iAddTheOptionToIt($optionName) |
||
488 | |||
489 | /** |
||
490 | * @When I set its :attribute attribute to :value |
||
491 | * @When I set its :attribute attribute to :value in :language |
||
492 | * @When I do not set its :attribute attribute in :language |
||
493 | */ |
||
494 | public function iSetItsAttributeTo($attribute, $value = null, $language = 'en_US') |
||
498 | |||
499 | /** |
||
500 | * @When I remove its :attribute attribute |
||
501 | * @When I remove its :attribute attribute from :language |
||
502 | */ |
||
503 | public function iRemoveItsAttribute($attribute, $language = 'en_US') |
||
507 | |||
508 | /** |
||
509 | * @When I try to add new attributes |
||
510 | */ |
||
511 | public function iTryToAddNewAttributes() |
||
515 | |||
516 | /** |
||
517 | * @When I do not want to have shipping required for this product |
||
518 | */ |
||
519 | public function iDoNotWantToHaveShippingRequiredForThisProduct() |
||
523 | |||
524 | /** |
||
525 | * @Then attribute :attributeName of product :product should be :value |
||
526 | * @Then attribute :attributeName of product :product should be :value in :language |
||
527 | */ |
||
528 | public function itsAttributeShouldBe($attributeName, ProductInterface $product, $value, $language = 'en_US') |
||
534 | |||
535 | /** |
||
536 | * @Then /^(product "[^"]+") should not have a "([^"]+)" attribute$/ |
||
537 | */ |
||
538 | public function productShouldNotHaveAttribute(ProductInterface $product, $attribute) |
||
544 | |||
545 | /** |
||
546 | * @Then /^product "[^"]+" should not have any attributes$/ |
||
547 | * @Then /^product "[^"]+" should have (\d+) attributes?$/ |
||
548 | */ |
||
549 | public function productShouldNotHaveAnyAttributes($count = 0) |
||
553 | |||
554 | /** |
||
555 | * @Given product with :element :value should not be added |
||
556 | */ |
||
557 | public function productWithNameShouldNotBeAdded($element, $value) |
||
563 | |||
564 | /** |
||
565 | * @When I remove its name from :language translation |
||
566 | */ |
||
567 | public function iRemoveItsNameFromTranslation($language) |
||
573 | |||
574 | /** |
||
575 | * @Then /^this product should have (?:a|an) "([^"]+)" option$/ |
||
576 | */ |
||
577 | public function thisProductShouldHaveOption($productOption) |
||
581 | |||
582 | /** |
||
583 | * @Then the option field should be disabled |
||
584 | */ |
||
585 | public function theOptionFieldShouldBeDisabled() |
||
589 | |||
590 | /** |
||
591 | * @When /^I choose main (taxon "[^"]+")$/ |
||
592 | */ |
||
593 | public function iChooseMainTaxon(TaxonInterface $taxon) |
||
599 | |||
600 | /** |
||
601 | * @Then /^the slug of the ("[^"]+" product) should(?:| still) be "([^"]+)"$/ |
||
602 | * @Then /^the slug of the ("[^"]+" product) should(?:| still) be "([^"]+)" (in the "[^"]+" locale)$/ |
||
603 | */ |
||
604 | public function productSlugShouldBe(ProductInterface $product, $slug, $locale = 'en_US') |
||
610 | |||
611 | /** |
||
612 | * @Then /^(this product) main taxon should be "([^"]+)"$/ |
||
613 | */ |
||
614 | public function thisProductMainTaxonShouldBe(ProductInterface $product, $taxonName) |
||
621 | |||
622 | /** |
||
623 | * @Then /^inventory of (this product) should not be tracked$/ |
||
624 | */ |
||
625 | public function thisProductShouldNotBeTracked(ProductInterface $product) |
||
631 | |||
632 | /** |
||
633 | * @Then /^inventory of (this product) should be tracked$/ |
||
634 | */ |
||
635 | public function thisProductShouldBeTracked(ProductInterface $product) |
||
641 | |||
642 | /** |
||
643 | * @When I attach the :path image with :type type |
||
644 | * @When I attach the :path image |
||
645 | */ |
||
646 | public function iAttachImageWithType($path, $type = null) |
||
652 | |||
653 | /** |
||
654 | * @When I associate as :productAssociationType the :productName product |
||
655 | * @When I associate as :productAssociationType the :firstProductName and :secondProductName products |
||
656 | */ |
||
657 | public function iAssociateProductsAsProductAssociation( |
||
665 | |||
666 | /** |
||
667 | * @When I remove an associated product :productName from :productAssociationType |
||
668 | */ |
||
669 | public function iRemoveAnAssociatedProductFromProductAssociation( |
||
677 | |||
678 | /** |
||
679 | * @Then /^(?:this product|the product "[^"]+"|it) should(?:| also) have an image with "([^"]*)" type$/ |
||
680 | */ |
||
681 | public function thisProductShouldHaveAnImageWithType($type) |
||
687 | |||
688 | /** |
||
689 | * @Then /^(?:this product|it)(?:| also) should not have any images with "([^"]*)" type$/ |
||
690 | */ |
||
691 | public function thisProductShouldNotHaveAnyImagesWithType($code) |
||
697 | |||
698 | /** |
||
699 | * @When I change the image with the :type type to :path |
||
700 | */ |
||
701 | public function iChangeItsImageToPathForTheType($type, $path) |
||
707 | |||
708 | /** |
||
709 | * @When /^I(?:| also) remove an image with "([^"]*)" type$/ |
||
710 | */ |
||
711 | public function iRemoveAnImageWithType($code) |
||
717 | |||
718 | /** |
||
719 | * @When I remove the first image |
||
720 | */ |
||
721 | public function iRemoveTheFirstImage() |
||
727 | |||
728 | /** |
||
729 | * @When I change the first image type to :type |
||
730 | */ |
||
731 | public function iChangeTheFirstImageTypeTo($type) |
||
737 | |||
738 | /** |
||
739 | * @Then /^(this product) should not have any images$/ |
||
740 | */ |
||
741 | public function thisProductShouldNotHaveImages(ProductInterface $product) |
||
749 | |||
750 | /** |
||
751 | * @Then /^(this product) should(?:| still) have (?:only one|(\d+)) images?$/ |
||
752 | */ |
||
753 | public function thereShouldStillBeOnlyOneImageInThisProduct(ProductInterface $product, $count = 1) |
||
761 | |||
762 | /** |
||
763 | * @Then /^there should be no reviews of (this product)$/ |
||
764 | */ |
||
765 | public function thereAreNoProductReviews(ProductInterface $product) |
||
771 | |||
772 | /** |
||
773 | * @Then this product should( also) have an association :productAssociationType with product :productName |
||
774 | * @Then this product should( also) have an association :productAssociationType with products :firstProductName and :secondProductName |
||
775 | */ |
||
776 | public function theProductShouldHaveAnAssociationWithProducts( |
||
791 | |||
792 | /** |
||
793 | * @Then this product should not have an association :productAssociationType with product :productName |
||
794 | */ |
||
795 | public function theProductShouldNotHaveAnAssociationWithProduct( |
||
801 | |||
802 | /** |
||
803 | * @Then I should be notified that simple product code has to be unique |
||
804 | */ |
||
805 | public function iShouldBeNotifiedThatSimpleProductCodeHasToBeUnique() |
||
809 | |||
810 | /** |
||
811 | * @Then I should be notified that slug has to be unique |
||
812 | */ |
||
813 | public function iShouldBeNotifiedThatSlugHasToBeUnique() |
||
817 | |||
818 | /** |
||
819 | * @Then I should be notified that code has to be unique |
||
820 | */ |
||
821 | public function iShouldBeNotifiedThatCodeHasToBeUnique() |
||
825 | |||
826 | /** |
||
827 | * @Then I should be notified that price must be defined for every channel |
||
828 | */ |
||
829 | public function iShouldBeNotifiedThatPriceMustBeDefinedForEveryChannel() |
||
833 | |||
834 | /** |
||
835 | * @Then they should have order like :firstProductName, :secondProductName and :thirdProductName |
||
836 | */ |
||
837 | public function theyShouldHaveOrderLikeAnd(...$productNames) |
||
841 | |||
842 | /** |
||
843 | * @When I save my new configuration |
||
844 | */ |
||
845 | public function iSaveMyNewConfiguration() |
||
849 | |||
850 | /** |
||
851 | * @When I set the position of :productName to :position |
||
852 | */ |
||
853 | public function iSetThePositionOfTo($productName, $position) |
||
857 | |||
858 | /** |
||
859 | * @Then this product should( still) have slug :value in :language |
||
860 | */ |
||
861 | public function thisProductElementShouldHaveSlugIn($slug, $language) |
||
865 | |||
866 | /** |
||
867 | * @When I set its shipping category as :shippingCategoryName |
||
868 | */ |
||
869 | public function iSetItsShippingCategoryAs($shippingCategoryName) |
||
873 | |||
874 | /** |
||
875 | * @Then /^(it|this product) should be priced at (?:€|£|\$)([^"]+) for channel "([^"]+)"$/ |
||
876 | * @Then /^(product "[^"]+") should be priced at (?:€|£|\$)([^"]+) for channel "([^"]+)"$/ |
||
877 | */ |
||
878 | public function itShouldBePricedAtForChannel(ProductInterface $product, $price, $channelName) |
||
884 | |||
885 | /** |
||
886 | * @Then /^(its|this products) original price should be "(?:€|£|\$)([^"]+)" for channel "([^"]+)"$/ |
||
887 | */ |
||
888 | public function itsOriginalPriceForChannel(ProductInterface $product, $originalPrice, $channelName) |
||
897 | |||
898 | /** |
||
899 | * @Then /^(this product) should no longer have price for channel "([^"]+)"$/ |
||
900 | */ |
||
901 | public function thisProductShouldNoLongerHavePriceForChannel(ProductInterface $product, $channelName) |
||
915 | |||
916 | /** |
||
917 | * @Then I should be notified that I have to define product variants' prices for newly assigned channels first |
||
918 | */ |
||
919 | public function iShouldBeNotifiedThatIHaveToDefineProductVariantsPricesForNewlyAssignedChannelsFirst() |
||
926 | |||
927 | /** |
||
928 | * @Then /^the (product "[^"]+") should not have shipping required$/ |
||
929 | */ |
||
930 | public function theProductWithCodeShouldNotHaveShippingRequired(ProductInterface $product) |
||
936 | |||
937 | /** |
||
938 | * @Then I should be notified that I have to define the :attribute attribute in :language |
||
939 | */ |
||
940 | public function iShouldBeNotifiedThatIHaveToDefineTheAttributeIn($attribute, $language) |
||
947 | |||
948 | /** |
||
949 | * @Then I should be notified that the :attribute attribute in :language should be longer than :number |
||
950 | */ |
||
951 | public function iShouldBeNotifiedThatTheAttributeInShouldBeLongerThan($attribute, $language, $number) |
||
958 | |||
959 | /** |
||
960 | * @param string $element |
||
961 | * @param string $value |
||
962 | */ |
||
963 | private function assertElementValue($element, $value) |
||
975 | |||
976 | /** |
||
977 | * @param string $element |
||
978 | * @param string $message |
||
979 | */ |
||
980 | private function assertValidationMessage($element, $message) |
||
987 | |||
988 | /** |
||
989 | * @return IndexPageInterface|IndexPerTaxonPageInterface|CreateSimpleProductPageInterface|CreateConfigurableProductPageInterface|UpdateSimpleProductPageInterface|UpdateConfigurableProductPageInterface |
||
990 | */ |
||
991 | private function resolveCurrentPage() |
||
1002 | } |
||
1003 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: