@@ 158-169 (lines=12) @@ | ||
155 | * |
|
156 | * @Then the JSON node :node should be equal to the string :text |
|
157 | */ |
|
158 | public function theJsonNodeShouldBeEqualToTheString($node, $text) |
|
159 | { |
|
160 | $json = $this->getJson(); |
|
161 | ||
162 | $actual = $this->inspector->evaluate($json, $node); |
|
163 | ||
164 | if ($actual !== $text) { |
|
165 | throw new \Exception( |
|
166 | sprintf('The node value is `%s`', json_encode($actual)) |
|
167 | ); |
|
168 | } |
|
169 | } |
|
170 | ||
171 | /** |
|
172 | * Checks, that given JSON node is equal to the given number |
|
@@ 176-187 (lines=12) @@ | ||
173 | * |
|
174 | * @Then the JSON node :node should be equal to the number :number |
|
175 | */ |
|
176 | public function theJsonNodeShouldBeEqualToTheNumber($node, $number) |
|
177 | { |
|
178 | $json = $this->getJson(); |
|
179 | ||
180 | $actual = $this->inspector->evaluate($json, $node); |
|
181 | ||
182 | if ($actual !== (float) $number && $actual !== (int) $number) { |
|
183 | throw new \Exception( |
|
184 | sprintf('The node value is `%s`', json_encode($actual)) |
|
185 | ); |
|
186 | } |
|
187 | } |
|
188 | ||
189 | /** |
|
190 | * Checks, that given JSON node has N element(s) |