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