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