1 | <?php |
||
22 | final class ManagingProductReviewsContext implements Context |
||
23 | { |
||
24 | /** @var ApiClientInterface */ |
||
25 | private $client; |
||
26 | |||
27 | /** @var SharedStorageInterface */ |
||
28 | private $sharedStorage; |
||
29 | |||
30 | public function __construct( |
||
37 | |||
38 | /** |
||
39 | * @When I browse product reviews |
||
40 | * @When I want to browse product reviews |
||
41 | */ |
||
42 | public function iWantToBrowseProductReviews(): void |
||
46 | |||
47 | /** |
||
48 | * @When I want to modify the :productReview product review |
||
49 | */ |
||
50 | public function iWantToModifyTheProductReview(ReviewInterface $productReview): void |
||
54 | |||
55 | /** |
||
56 | * @When I change its title to :title |
||
57 | * @when I remove its title |
||
58 | */ |
||
59 | public function iChangeItsTitleTo(?string $title = ''): void |
||
63 | |||
64 | /** |
||
65 | * @When I change its comment to :comment |
||
66 | * @when I remove its comment |
||
67 | */ |
||
68 | public function iChangeItsCommentTo(?string $comment = ''): void |
||
72 | |||
73 | /** |
||
74 | * @When I save my changes |
||
75 | * @When I try to save my changes |
||
76 | */ |
||
77 | public function iSaveMyChanges(): void |
||
81 | |||
82 | /** |
||
83 | * @When I choose :rating as its rating |
||
84 | */ |
||
85 | public function iChooseAsItsRating(int $rating): void |
||
89 | |||
90 | /** |
||
91 | * @When /^I (accept|reject) the ("([^"]+)" product review)$/ |
||
92 | */ |
||
93 | public function iChangeStateTheProductReview(string $state, ReviewInterface $productReview): void |
||
97 | |||
98 | /** |
||
99 | * @When I delete the :productReview product review |
||
100 | */ |
||
101 | public function iDeleteTheProductReview(ReviewInterface $productReview): void |
||
107 | |||
108 | /** |
||
109 | * @Then I should (also) see the product review :title in the list |
||
110 | */ |
||
111 | public function iShouldSeeTheProductReviewTitleInTheList(string $title): void |
||
118 | |||
119 | /** |
||
120 | * @Then I should see a single product review in the list |
||
121 | * @Then I should see :amount reviews in the list |
||
122 | */ |
||
123 | public function iShouldSeeReviewsInTheList(int $amount = 1): void |
||
127 | |||
128 | /** |
||
129 | * @Then /^(this product review) (comment|title) should be "([^"]+)"$/ |
||
130 | */ |
||
131 | public function thisProductReviewElementShouldBeValue(ReviewInterface $productReview, string $element, string $value): void |
||
135 | |||
136 | /** |
||
137 | * @Then /^(this product review) rating should be (\d+)$/ |
||
138 | */ |
||
139 | public function thisProductReviewRatingShouldBe(ReviewInterface $productReview, int $rating): void |
||
143 | |||
144 | /** |
||
145 | * @Then /^(this product review) status should be "([^"]+)"$/ |
||
146 | */ |
||
147 | public function thisProductReviewStatusShouldBe(ReviewInterface $productReview, string $status): void |
||
151 | |||
152 | /** |
||
153 | * @Then /^I should be notified that it has been successfully (accepted|rejected)$/ |
||
154 | */ |
||
155 | public function iShouldBeNotifiedThatItHasBeenSuccessfullyUpdated(string $action): void |
||
159 | |||
160 | /** |
||
161 | * @Then this product review should no longer exist in the registry |
||
162 | */ |
||
163 | public function thisProductReviewShouldNoLongerExistInTheRegistry(): void |
||
171 | |||
172 | /** |
||
173 | * @Then I should be notified that :element is required |
||
174 | */ |
||
175 | public function iShouldBeNotifiedThatElementIsRequired(string $element): void |
||
179 | |||
180 | /** |
||
181 | * @Then /^(this product review) should still be titled "([^"]+)"$/ |
||
182 | */ |
||
183 | public function thisProductReviewTitleShouldBeTitled(ReviewInterface $productReview, string $title): void |
||
187 | |||
188 | /** |
||
189 | * @Then /^(this product review) should still have a comment "([^"]+)"$/ |
||
190 | */ |
||
191 | public function thisProductReviewShouldStillHaveAComment(ReviewInterface $productReview, string $comment): void |
||
195 | |||
196 | private function isItemOnIndex(string $property, string $value): bool |
||
202 | |||
203 | /** @param string|int $value */ |
||
204 | private function assertIfReviewHasElementWithValue(ReviewInterface $productReview, string $element, $value): void |
||
212 | } |
||
213 |