Skip to content

Commit 70db8df

Browse files
Merge pull request #1777 from bendavies/fix-features
fix getting value of a node
2 parents c2e5b77 + c52ea0a commit 70db8df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

features/bootstrap/JsonApiContext.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
2020
use Behatch\Context\RestContext;
2121
use Behatch\Json\Json;
22+
use Behatch\Json\JsonInspector;
2223
use Doctrine\Common\Persistence\ManagerRegistry;
2324
use JsonSchema\Validator;
2425
use PHPUnit\Framework\ExpectationFailedException;
@@ -30,6 +31,7 @@ final class JsonApiContext implements Context
3031
*/
3132
private $restContext;
3233
private $validator;
34+
private $inspector;
3335
private $jsonApiSchemaFile;
3436
private $manager;
3537

@@ -40,6 +42,7 @@ public function __construct(ManagerRegistry $doctrine, string $jsonApiSchemaFile
4042
}
4143

4244
$this->validator = new Validator();
45+
$this->inspector = new JsonInspector('javascript');
4346
$this->jsonApiSchemaFile = $jsonApiSchemaFile;
4447
$this->manager = $doctrine->getManager();
4548
}
@@ -145,8 +148,7 @@ public function thereIsACircularReference()
145148

146149
private function getValueOfNode($node)
147150
{
148-
$json = $this->getJson();
149-
$this->validator->validate($json, $node);
151+
return $this->inspector->evaluate($this->getJson(), $node);
150152
}
151153

152154
private function getJson()

0 commit comments

Comments
 (0)