1 | <?php declare(strict_types=1); |
||
24 | abstract class AbstractContext implements BehatContext |
||
25 | { |
||
26 | /** @var PropertyAccessor */ |
||
27 | private $accessor; |
||
28 | |||
29 | public function __construct() |
||
33 | |||
34 | abstract protected function getJson(); |
||
35 | |||
36 | protected function getValue(string $path) |
||
40 | |||
41 | /** @Then :path should be accessible in the latest json response */ |
||
42 | final public function path_should_be_readable(string $path): void |
||
46 | |||
47 | /** @Then :path should not exist in the latest json response */ |
||
48 | final public function path_should_not_be_readable(string $path): void |
||
52 | |||
53 | /** @Then in the json, :path should be equal to :expected */ |
||
54 | final public function the_json_path_should_be_equal_to(string $path, $expected): void |
||
58 | |||
59 | /** @Then in the json, :path should not be equal to :expected */ |
||
60 | final public function the_json_path_should_not_be_equal_to(string $path, $expected): void |
||
64 | |||
65 | /** @Then in the json, :path should be: */ |
||
66 | final public function the_json_path_should_be_py_string(string $path, PyStringNode $expected): void |
||
70 | |||
71 | /** @Then /^in the json, "(?P<path>(?:[^"]|\\")*)" should be (?P<expected>true|false)$/ */ |
||
72 | final public function the_json_path_should_be(string $path, string $expected): void |
||
76 | |||
77 | /** @Then /^in the json, "(?P<path>(?:[^"]|\\")*)" should not be (?P<expected>true|false)$/ */ |
||
78 | final public function the_json_path_should_not_be(string $path, string $expected): void |
||
82 | |||
83 | /** @Then in the json, :path should be null */ |
||
84 | final public function the_json_path_should_be_null(string $path): void |
||
88 | |||
89 | /** @Then in the json, :path should not be null */ |
||
90 | final public function the_json_path_should_not_be_null(string $path): void |
||
94 | |||
95 | /** @Then in the json, :path should be empty */ |
||
96 | final public function the_json_path_should_be_empty(string $path): void |
||
100 | |||
101 | /** @Then in the json, :path should not be empty */ |
||
102 | final public function the_json_path_should_not_be_empty(string $path): void |
||
106 | |||
107 | /** @Then in the json, :path should contain :expected */ |
||
108 | final public function the_json_path_contains(string $path, $expected): void |
||
112 | |||
113 | /** @Then /^in the json, :path should not contain :expected */ |
||
114 | final public function the_json_path_not_contains(string $path, $expected): void |
||
118 | |||
119 | /** @Then in the json, :path collection should contain an element with :value equal to :expected */ |
||
120 | final public function the_json_path_collection_contains(string $path, string $value, $expected): void |
||
132 | |||
133 | /** @Then in the json, :path should be a valid date(time) */ |
||
134 | final public function the_json_path_should_be_a_valid_date(string $path): void |
||
142 | |||
143 | /** @Then in the json, :path should be greater than :expected */ |
||
144 | final public function the_json_path_should_be_greater_than(string $path, int $expected): void |
||
148 | |||
149 | /** @Then in the json, :path should be greater than or equal to :expected */ |
||
150 | final public function the_json_path_should_be_greater_or_equal_than(string $path, int $expected): void |
||
154 | |||
155 | /** @Then in the json, :path should be less than :expected */ |
||
156 | final public function the_json_path_should_be_less_than(string $path, int $expected): void |
||
160 | |||
161 | /** @Then in the json, :path should be less than or equal to :expected */ |
||
162 | final public function the_json_path_should_be_less_or_equal_than(string $path, int $expected): void |
||
166 | |||
167 | /** @Then in the json, :path should be an array */ |
||
168 | final public function should_be_an_array(string $path): void |
||
172 | |||
173 | /** @Then in the json, :path should have at least :count element(s) */ |
||
174 | final public function the_json_path_should_have_at_least_elements(string $path, int $count): void |
||
181 | |||
182 | /** @Then in the json, :path should have :count element(s) */ |
||
183 | final public function the_json_path_should_have_elements(string $path, int $count): void |
||
187 | |||
188 | /** @Then in the json, :path should have at most :count element(s) */ |
||
189 | final public function the_json_path_should_have_at_most_elements(string $path, int $count): void |
||
196 | |||
197 | /** @Then in the json, :path should match :pattern */ |
||
198 | final public function the_json_path_should_match(string $path, string $pattern): void |
||
202 | |||
203 | /** |
||
204 | * @Then in the json, :path should not match :pattern |
||
205 | * |
||
206 | * ----- |
||
207 | * |
||
208 | * Note :: The body of this assertion should be replaced by a |
||
209 | * `Assert::notRegex` as soon as the Assert's PR |
||
210 | * https://github.com/webmozart/assert/pull/58 is merged and released. |
||
211 | */ |
||
212 | final public function the_json_path_should_not_match(string $path, string $pattern): void |
||
221 | |||
222 | /** @Then in the json, the root should be an array */ |
||
223 | final public function root_should_be_an_array(): void |
||
227 | |||
228 | /** @Then in the json, the root should have :count element(s) */ |
||
229 | final public function the_root_should_have_elements(int $count): void |
||
236 | |||
237 | /** @Then in the json, the root should have at most :count element(s) */ |
||
238 | final public function the_root_should_have_at_most_elements(int $count): void |
||
245 | |||
246 | /** @Then in the json, :path should be a valid json encoded string */ |
||
247 | final public function the_json_path_should_be_a_valid_json_encoded_string(string $path): void |
||
254 | } |
||
255 |