| @@ 137-148 (lines=12) @@ | ||
| 134 | * |
|
| 135 | * @Then the JSON node :node should be equal to the string :text |
|
| 136 | */ |
|
| 137 | public function theJsonNodeShouldBeEqualToTheString($node, $text) |
|
| 138 | { |
|
| 139 | $json = $this->getJson(); |
|
| 140 | ||
| 141 | $actual = $this->inspector->evaluate($json, $node); |
|
| 142 | ||
| 143 | if ($actual !== $text) { |
|
| 144 | throw new \Exception( |
|
| 145 | sprintf('The node value is `%s`', json_encode($actual)) |
|
| 146 | ); |
|
| 147 | } |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * Checks, that given JSON node is equal to the given number |
|
| @@ 155-166 (lines=12) @@ | ||
| 152 | * |
|
| 153 | * @Then the JSON node :node should be equal to the number :number |
|
| 154 | */ |
|
| 155 | public function theJsonNodeShouldBeEqualToTheNumber($node, $number) |
|
| 156 | { |
|
| 157 | $json = $this->getJson(); |
|
| 158 | ||
| 159 | $actual = $this->inspector->evaluate($json, $node); |
|
| 160 | ||
| 161 | if ($actual !== (float) $number && $actual !== (int) $number) { |
|
| 162 | throw new \Exception( |
|
| 163 | sprintf('The node value is `%s`', json_encode($actual)) |
|
| 164 | ); |
|
| 165 | } |
|
| 166 | } |
|
| 167 | ||
| 168 | /** |
|
| 169 | * Checks, that given JSON node has N element(s) |
|