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