I have a laravel API project. There is a lot security data, that shouldn't be shown for users in API responses. I need some way to write tests where I can get true
if only the response structure is exact same as a pre-set structure in test.
So, if my test structure is $structure = [ 'data' => ['_id', 'user' => ['name', 'email], 'title'];
but in response I'm recieveing more or less fields, I need this test to be failed.
In a docs I've found only:
assertJson
- expecting for exact key => values, but I need a keys only;
assertJsonStructure
- returns true even if some fields missing or response contains some other fields.