1 | <?php |
||
29 | final class ManagingProductAttributesContext implements Context |
||
30 | { |
||
31 | /** |
||
32 | * @var CreatePageInterface |
||
33 | */ |
||
34 | private $createPage; |
||
35 | |||
36 | /** |
||
37 | * @var IndexPageInterface |
||
38 | */ |
||
39 | private $indexPage; |
||
40 | |||
41 | /** |
||
42 | * @var UpdatePageInterface |
||
43 | */ |
||
44 | private $updatePage; |
||
45 | |||
46 | /** |
||
47 | * @var CurrentPageResolverInterface |
||
48 | */ |
||
49 | private $currentPageResolver; |
||
50 | |||
51 | /** |
||
52 | * @var SharedSecurityServiceInterface |
||
53 | */ |
||
54 | private $sharedSecurityService; |
||
55 | |||
56 | /** |
||
57 | * @param CreatePageInterface $createPage |
||
58 | * @param IndexPageInterface $indexPage |
||
59 | * @param UpdatePageInterface $updatePage |
||
60 | * @param CurrentPageResolverInterface $currentPageResolver |
||
61 | * @param SharedSecurityServiceInterface $sharedSecurityService |
||
62 | */ |
||
63 | public function __construct( |
||
76 | |||
77 | /** |
||
78 | * @When I want to create a new :type product attribute |
||
79 | */ |
||
80 | public function iWantToCreateANewTextProductAttribute($type) |
||
84 | |||
85 | /** |
||
86 | * @When I specify its code as :code |
||
87 | * @When I do not specify its code |
||
88 | */ |
||
89 | public function iSpecifyItsCodeAs($code = null) |
||
93 | |||
94 | /** |
||
95 | * @When I name it :name in :language |
||
96 | */ |
||
97 | public function iSpecifyItsNameAs($name, $language) |
||
101 | |||
102 | /** |
||
103 | * @When I add it |
||
104 | * @When I try to add it |
||
105 | */ |
||
106 | public function iAddIt() |
||
110 | |||
111 | /** |
||
112 | * @When I( also) add value :value |
||
113 | */ |
||
114 | public function iAddValue(string $value): void |
||
121 | |||
122 | /** |
||
123 | * @When I change its value :oldValue to :newValue |
||
124 | */ |
||
125 | public function iChangeItsValueTo(string $oldValue, string $newValue): void |
||
129 | |||
130 | /** |
||
131 | * @Then I should see the product attribute :name in the list |
||
132 | */ |
||
133 | public function iShouldSeeTheProductAttributeInTheList($name) |
||
139 | |||
140 | /** |
||
141 | * @Then the :type attribute :name should appear in the store |
||
142 | */ |
||
143 | public function theAttributeShouldAppearInTheStore($type, $name) |
||
152 | |||
153 | /** |
||
154 | * @When /^I want to edit (this product attribute)$/ |
||
155 | */ |
||
156 | public function iWantToEditThisAttribute(ProductAttributeInterface $productAttribute) |
||
160 | |||
161 | /** |
||
162 | * @When I change its name to :name in :language |
||
163 | */ |
||
164 | public function iChangeItNameToIn($name, $language) |
||
168 | |||
169 | /** |
||
170 | * @When I save my changes |
||
171 | * @When I try to save my changes |
||
172 | */ |
||
173 | public function iSaveMyChanges() |
||
177 | |||
178 | /** |
||
179 | * @Then the code field should be disabled |
||
180 | */ |
||
181 | public function theCodeFieldShouldBeDisabled() |
||
185 | |||
186 | /** |
||
187 | * @Then the type field should be disabled |
||
188 | */ |
||
189 | public function theTypeFieldShouldBeDisabled() |
||
195 | |||
196 | /** |
||
197 | * @Then I should be notified that product attribute with this code already exists |
||
198 | */ |
||
199 | public function iShouldBeNotifiedThatProductAttributeWithThisCodeAlreadyExists() |
||
203 | |||
204 | /** |
||
205 | * @Then there should still be only one product attribute with code :code |
||
206 | */ |
||
207 | public function thereShouldStillBeOnlyOneProductAttributeWithCode($code) |
||
213 | |||
214 | /** |
||
215 | * @When I do not name it |
||
216 | */ |
||
217 | public function iDoNotNameIt() |
||
221 | |||
222 | /** |
||
223 | * @Then I should be notified that :element is required |
||
224 | */ |
||
225 | public function iShouldBeNotifiedThatIsRequired($element) |
||
229 | |||
230 | /** |
||
231 | * @Given the attribute with :elementName :elementValue should not appear in the store |
||
232 | */ |
||
233 | public function theAttributeWithCodeShouldNotAppearInTheStore($elementName, $elementValue) |
||
239 | |||
240 | /** |
||
241 | * @When I remove its name from :language translation |
||
242 | */ |
||
243 | public function iRemoveItsNameFromTranslation($language) |
||
247 | |||
248 | /** |
||
249 | * @When I want to see all product attributes in store |
||
250 | */ |
||
251 | public function iWantToSeeAllProductAttributesInStore() |
||
255 | |||
256 | /** |
||
257 | * @When /^(the administrator) changes (this product attribute)'s value "([^"]*)" to "([^"]*)"$/ |
||
258 | */ |
||
259 | public function theAdministratorChangesTheValueTo( |
||
274 | |||
275 | /** |
||
276 | * @Then /^I should see (\d+) product attributes in the list$/ |
||
277 | */ |
||
278 | public function iShouldSeeCustomersInTheList($amountOfProductAttributes) |
||
282 | |||
283 | /** |
||
284 | * @When /^I delete (this product attribute)$/ |
||
285 | */ |
||
286 | public function iDeleteThisProductAttribute(ProductAttributeInterface $productAttribute) |
||
291 | |||
292 | /** |
||
293 | * @Then /^(this product attribute) should no longer exist in the registry$/ |
||
294 | */ |
||
295 | public function thisProductAttributeShouldNoLongerExistInTheRegistry(ProductAttributeInterface $productAttribute) |
||
299 | |||
300 | /** |
||
301 | * @Then the first product attribute on the list should have name :name |
||
302 | */ |
||
303 | public function theFirstProductAttributeOnTheListShouldHave($name) |
||
309 | |||
310 | /** |
||
311 | * @Then the last product attribute on the list should have name :name |
||
312 | */ |
||
313 | public function theLastProductAttributeOnTheListShouldHave($name) |
||
319 | |||
320 | /** |
||
321 | * @Then /^(this product attribute) should have value "([^"]*)"/ |
||
322 | */ |
||
323 | public function theSelectAttributeShouldHaveValue(ProductAttributeInterface $productAttribute, string $value): void |
||
329 | |||
330 | /** |
||
331 | * @param string $element |
||
332 | * @param string $expectedMessage |
||
333 | */ |
||
334 | private function assertFieldValidationMessage($element, $expectedMessage) |
||
341 | } |
||
342 |