martin-helmich/phpunit-json-assert

Properties

sergeysrabionyan opened this issue · 4 comments

How can I check attached properties?

What exactly do you mean? Can you provide an example of what you want to achieve?

i need to check
{
"data": {
"id": 8,
"title": "Quas qui dicta quae quia sunt."

asserts work on (data) but do not work on id, title

 $schema = [
        'properties' => [
            'data' => ['type' => 'object'],
            'id'=>['type'=>'string'],
        ]];
    $this->assertJsonDocumentMatchesSchema($content, $schema);

I specifically made a mistake in the id scheme, but the test passes

I found my mistake,i needed to do this
$schema = [
'properties' => [
'data' => ['type' => 'object',
'properties' => [
'id' => ['type' => 'integer'],
'title' => ['type' => 'string']
]],
]];