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