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