1 | <?php |
||
24 | final class ManagingProductOptionsContext implements Context |
||
25 | { |
||
26 | /** @var IndexPageInterface */ |
||
27 | private $indexPage; |
||
28 | |||
29 | /** @var CreatePageInterface */ |
||
30 | private $createPage; |
||
31 | |||
32 | /** @var UpdatePageInterface */ |
||
33 | private $updatePage; |
||
34 | |||
35 | /** @var CurrentPageResolverInterface */ |
||
36 | private $currentPageResolver; |
||
37 | |||
38 | public function __construct( |
||
49 | |||
50 | /** |
||
51 | * @Given I want to create a new product option |
||
52 | */ |
||
53 | public function iWantToCreateANewProductOption() |
||
57 | |||
58 | /** |
||
59 | * @Given I want to modify the :productOption product option |
||
60 | */ |
||
61 | public function iWantToModifyAProductOption(ProductOptionInterface $productOption) |
||
65 | |||
66 | /** |
||
67 | * @When I browse product options |
||
68 | */ |
||
69 | public function iBrowseProductOptions() |
||
73 | |||
74 | /** |
||
75 | * @When I add it |
||
76 | * @When I try to add it |
||
77 | */ |
||
78 | public function iAddIt() |
||
82 | |||
83 | /** |
||
84 | * @When I save my changes |
||
85 | * @When I try to save my changes |
||
86 | */ |
||
87 | public function iSaveMyChanges() |
||
91 | |||
92 | /** |
||
93 | * @When I name it :name in :language |
||
94 | */ |
||
95 | public function iNameItInLanguage($name, $language) |
||
99 | |||
100 | /** |
||
101 | * @When I rename it to :name in :language |
||
102 | * @When I remove its name from :language translation |
||
103 | */ |
||
104 | public function iRenameItToInLanguage($name = null, $language) |
||
108 | |||
109 | /** |
||
110 | * @When I do not name it |
||
111 | */ |
||
112 | public function iDoNotNameIt() |
||
116 | |||
117 | /** |
||
118 | * @When I specify its code as :code |
||
119 | * @When I do not specify its code |
||
120 | */ |
||
121 | public function iSpecifyItsCodeAs($code = null) |
||
125 | |||
126 | /** |
||
127 | * @When I add the :value option value identified by :code |
||
128 | */ |
||
129 | public function iAddTheOptionValueWithCodeAndValue($value, $code) |
||
136 | |||
137 | /** |
||
138 | * @When I check (also) the :productOptionName product option |
||
139 | */ |
||
140 | public function iCheckTheProductOption(string $productOptionName): void |
||
144 | |||
145 | /** |
||
146 | * @When I delete them |
||
147 | */ |
||
148 | public function iDeleteThem(): void |
||
152 | |||
153 | /** |
||
154 | * @Then I should see the product option :productOptionName in the list |
||
155 | * @Then the product option :productOptionName should appear in the registry |
||
156 | * @Then the product option :productOptionName should be in the registry |
||
157 | */ |
||
158 | public function theProductOptionShouldAppearInTheRegistry(string $productOptionName): void |
||
164 | |||
165 | /** |
||
166 | * @Then I should be notified that product option with this code already exists |
||
167 | */ |
||
168 | public function iShouldBeNotifiedThatProductOptionWithThisCodeAlreadyExists() |
||
172 | |||
173 | /** |
||
174 | * @Then there should still be only one product option with :element :value |
||
175 | */ |
||
176 | public function thereShouldStillBeOnlyOneProductOptionWith($element, $value) |
||
182 | |||
183 | /** |
||
184 | * @Then I should be notified that :element is required |
||
185 | */ |
||
186 | public function iShouldBeNotifiedThatElementIsRequired($element) |
||
190 | |||
191 | /** |
||
192 | * @Then the product option with :element :value should not be added |
||
193 | */ |
||
194 | public function theProductOptionWithElementValueShouldNotBeAdded($element, $value) |
||
200 | |||
201 | /** |
||
202 | * @Then /^(this product option) should still be named "([^"]+)"$/ |
||
203 | * @Then /^(this product option) name should be "([^"]+)"$/ |
||
204 | */ |
||
205 | public function thisProductOptionNameShouldStillBe(ProductOptionInterface $productOption, $productOptionName) |
||
214 | |||
215 | /** |
||
216 | * @Then I should not be able to edit its code |
||
217 | */ |
||
218 | public function iShouldNotBeAbleToEditItsCode(): void |
||
219 | { |
||
220 | Assert::true($this->updatePage->isCodeDisabled()); |
||
221 | } |
||
222 | |||
223 | /** |
||
224 | * @When I do not add an option value |
||
225 | */ |
||
226 | public function iDoNotAddAnOptionValue() |
||
230 | |||
231 | /** |
||
232 | * @Then I should be notified that at least two option values are required |
||
233 | */ |
||
234 | public function iShouldBeNotifiedThatAtLeastTwoOptionValuesAreRequired() |
||
238 | |||
239 | /** |
||
240 | * @Then I should see a single product option in the list |
||
241 | * @Then I should see :amount product options in the list |
||
242 | */ |
||
243 | public function iShouldSeeProductOptionsInTheList(int $amount = 1): void |
||
247 | |||
248 | /** |
||
249 | * @Then /^(this product option) should have the "([^"]*)" option value$/ |
||
250 | * @Then /^(product option "[^"]+") should have the "([^"]*)" option value$/ |
||
251 | */ |
||
252 | public function thisProductOptionShouldHaveTheOptionValue(ProductOptionInterface $productOption, $optionValue) |
||
258 | |||
259 | /** |
||
260 | * @Then the first product option in the list should have :field :value |
||
261 | */ |
||
262 | public function theFirstProductOptionInTheListShouldHave($field, $value) |
||
266 | |||
267 | /** |
||
268 | * @Then the last product option in the list should have :field :value |
||
269 | */ |
||
270 | public function theLastProductOptionInTheListShouldHave($field, $value) |
||
276 | } |
||
277 |