codeception seeResponseMatchesJsonType allow null | array

Viewed 383

I would like to check that the json structure matches the following:

$I->seeResponseMatchesJsonType([
            'user' => [
                'id' => 'string',
                'name' => 'string',
                'avatar' => 'string'
            ]);

However it should also accept if the user is null. It works with primitive types:

$I->seeResponseMatchesJsonType([
            'user' => 'null|string'
]); 

But how can I do this with the nested array?

0 Answers
Related