1 | <?php |
||
25 | final class ManagingTaxonsContext implements Context |
||
26 | { |
||
27 | /** @var SharedStorageInterface */ |
||
28 | private $sharedStorage; |
||
29 | |||
30 | /** @var CreatePageInterface */ |
||
31 | private $createPage; |
||
32 | |||
33 | /** @var CreateForParentPageInterface */ |
||
34 | private $createForParentPage; |
||
35 | |||
36 | /** @var UpdatePageInterface */ |
||
37 | private $updatePage; |
||
38 | |||
39 | /** @var CurrentPageResolverInterface */ |
||
40 | private $currentPageResolver; |
||
41 | |||
42 | public function __construct( |
||
55 | |||
56 | /** |
||
57 | * @Given I want to create a new taxon |
||
58 | * @Given I want to see all taxons in store |
||
59 | */ |
||
60 | public function iWantToCreateANewTaxon() |
||
64 | |||
65 | /** |
||
66 | * @Given I want to create a new taxon for :taxon |
||
67 | */ |
||
68 | public function iWantToCreateANewTaxonForParent(TaxonInterface $taxon) |
||
72 | |||
73 | /** |
||
74 | * @Given /^I want to modify the ("[^"]+" taxon)$/ |
||
75 | */ |
||
76 | public function iWantToModifyATaxon(TaxonInterface $taxon) |
||
82 | |||
83 | /** |
||
84 | * @When I specify its code as :code |
||
85 | * @When I do not specify its code |
||
86 | */ |
||
87 | public function iSpecifyItsCodeAs(?string $code = null) |
||
91 | |||
92 | /** |
||
93 | * @When I name it :name in :language |
||
94 | * @When I rename it to :name in :language |
||
95 | * @When I do not specify its name |
||
96 | */ |
||
97 | public function iNameItIn(?string $name = null, $language = 'en_US') |
||
103 | |||
104 | /** |
||
105 | * @When I set its slug to :slug |
||
106 | * @When I do not specify its slug |
||
107 | * @When I set its slug to :slug in :language |
||
108 | */ |
||
109 | public function iSetItsSlugToIn(?string $slug = null, $language = 'en_US') |
||
115 | |||
116 | /** |
||
117 | * @Then the slug field should not be editable |
||
118 | * @Then the slug field should (also )not be editable in :language |
||
119 | */ |
||
120 | public function theSlugFieldShouldNotBeEditable($language = 'en_US') |
||
124 | |||
125 | /** |
||
126 | * @When I enable slug modification |
||
127 | * @When I enable slug modification in :language |
||
128 | */ |
||
129 | public function iEnableSlugModification($language = 'en_US') |
||
134 | |||
135 | /** |
||
136 | * @When I change its description to :description in :language |
||
137 | */ |
||
138 | public function iChangeItsDescriptionToIn($description, $language) |
||
142 | |||
143 | /** |
||
144 | * @When I describe it as :description in :language |
||
145 | */ |
||
146 | public function iDescribeItAs($description, $language) |
||
150 | |||
151 | /** |
||
152 | * @Given /^I change its (parent taxon to "[^"]+")$/ |
||
153 | */ |
||
154 | public function iChangeItsParentTaxonTo(TaxonInterface $taxon) |
||
158 | |||
159 | /** |
||
160 | * @When I add it |
||
161 | * @When I try to add it |
||
162 | */ |
||
163 | public function iAddIt() |
||
167 | |||
168 | /** |
||
169 | * @When I save my changes |
||
170 | * @When I try to save my changes |
||
171 | */ |
||
172 | public function iSaveMyChanges() |
||
176 | |||
177 | /** |
||
178 | * @Then /^the ("[^"]+" taxon) should appear in the registry$/ |
||
179 | */ |
||
180 | public function theTaxonShouldAppearInTheRegistry(TaxonInterface $taxon) |
||
185 | |||
186 | /** |
||
187 | * @Then this taxon :element should be :value |
||
188 | */ |
||
189 | public function thisTaxonElementShouldBe($element, $value) |
||
193 | |||
194 | /** |
||
195 | * @Then this taxon should have slug :value in :language |
||
196 | */ |
||
197 | public function thisTaxonElementShouldHaveSlugIn($value, $language = null) |
||
205 | |||
206 | /** |
||
207 | * @Then the code field should be disabled |
||
208 | */ |
||
209 | public function theCodeFieldShouldBeDisabled() |
||
213 | |||
214 | /** |
||
215 | * @Then /^the slug of the ("[^"]+" taxon) should(?:| still) be "([^"]+)"$/ |
||
216 | */ |
||
217 | public function productSlugShouldBe(TaxonInterface $taxon, $slug) |
||
223 | |||
224 | /** |
||
225 | * @Then /^this taxon should (belongs to "[^"]+")$/ |
||
226 | */ |
||
227 | public function thisTaxonShouldBelongsTo(TaxonInterface $taxon) |
||
231 | |||
232 | /** |
||
233 | * @Given it should not belong to any other taxon |
||
234 | */ |
||
235 | public function itShouldNotBelongToAnyOtherTaxon() |
||
239 | |||
240 | /** |
||
241 | * @Then I should be notified that taxon with this code already exists |
||
242 | */ |
||
243 | public function iShouldBeNotifiedThatTaxonWithThisCodeAlreadyExists() |
||
249 | |||
250 | /** |
||
251 | * @Then I should be notified that taxon slug must be unique |
||
252 | */ |
||
253 | public function iShouldBeNotifiedThatTaxonSlugMustBeUnique() |
||
259 | |||
260 | /** |
||
261 | * @Then I should be notified that :element is required |
||
262 | */ |
||
263 | public function iShouldBeNotifiedThatIsRequired($element) |
||
269 | |||
270 | /** |
||
271 | * @Then /^there should(?:| still) be only one taxon with code "([^"]+)"$/ |
||
272 | */ |
||
273 | public function thereShouldStillBeOnlyOneTaxonWithCode($code) |
||
277 | |||
278 | /** |
||
279 | * @Then /^taxon named "([^"]+)" should not be added$/ |
||
280 | * @Then the taxon named :name should no longer exist in the registry |
||
281 | */ |
||
282 | public function taxonNamedShouldNotBeAdded($name) |
||
286 | |||
287 | /** |
||
288 | * @Then /^I should see (\d+) taxons on the list$/ |
||
289 | */ |
||
290 | public function iShouldSeeTaxonsInTheList($number) |
||
294 | |||
295 | /** |
||
296 | * @Then I should see the taxon named :name in the list |
||
297 | */ |
||
298 | public function iShouldSeeTheTaxonNamedInTheList($name) |
||
302 | |||
303 | /** |
||
304 | * @When I attach the :path image with :type type |
||
305 | * @When I attach the :path image |
||
306 | */ |
||
307 | public function iAttachImageWithType($path, $type = null) |
||
313 | |||
314 | /** |
||
315 | * @Then /^(?:it|this taxon) should(?:| also) have an image with "([^"]*)" type$/ |
||
316 | */ |
||
317 | public function thisTaxonShouldHaveAnImageWithType($type) |
||
321 | |||
322 | /** |
||
323 | * @Then /^(?:this taxon|it) should not have(?:| also) any images with "([^"]*)" type$/ |
||
324 | */ |
||
325 | public function thisTaxonShouldNotHaveAnImageWithType($code) |
||
329 | |||
330 | /** |
||
331 | * @When /^I(?:| also) remove an image with "([^"]*)" type$/ |
||
332 | */ |
||
333 | public function iRemoveAnImageWithType($code) |
||
337 | |||
338 | /** |
||
339 | * @When I remove the first image |
||
340 | */ |
||
341 | public function iRemoveTheFirstImage() |
||
345 | |||
346 | /** |
||
347 | * @Then /^(this taxon) should not have any images$/ |
||
348 | */ |
||
349 | public function thisTaxonShouldNotHaveAnyImages(TaxonInterface $taxon) |
||
355 | |||
356 | /** |
||
357 | * @When I change the image with the :type type to :path |
||
358 | */ |
||
359 | public function iChangeItsImageToPathForTheType($path, $type) |
||
363 | |||
364 | /** |
||
365 | * @When I change the first image type to :type |
||
366 | */ |
||
367 | public function iChangeTheFirstImageTypeTo($type) |
||
371 | |||
372 | /** |
||
373 | * @Then /^(this taxon) should have only one image$/ |
||
374 | * @Then /^(this taxon) should(?:| still) have (\d+) images?$/ |
||
375 | */ |
||
376 | public function thereShouldStillBeOnlyOneImageInThisTaxon(TaxonInterface $taxon, $count = 1) |
||
382 | |||
383 | /** |
||
384 | * @return CreatePageInterface|CreateForParentPageInterface|UpdatePageInterface |
||
385 | */ |
||
386 | private function resolveCurrentPage() |
||
394 | } |
||
395 |