You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: testing.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -207,11 +207,11 @@ If you would like to verify that the given array is an **exact** match for the J
207
207
]);
208
208
}
209
209
}
210
-
210
+
211
211
<aname="verify-structural-json-match"></a>
212
212
#### Verify Structural JSON Match
213
213
214
-
It is also possible to verify that the response adheres to a specific structure. For this, you should use the `seeJsonStructure` method and pass it a list of (nested) keys:
214
+
It is also possible to verify that a JSON response adheres to a specific structure. For this, you should use the `seeJsonStructure` method and pass it a list of (nested) keys:
215
215
216
216
<?php
217
217
@@ -226,15 +226,15 @@ It is also possible to verify that the response adheres to a specific structure.
226
226
{
227
227
$this->get('/user/1')
228
228
->seeJsonStructure([
229
-
'name',
229
+
'name',
230
230
'pet' => [
231
231
'name', 'age'
232
232
]
233
233
]);
234
234
}
235
235
}
236
236
237
-
The above example illustrates an expectation of receiving a `name`of the `user`and a nested `pet` object with its own `name` and `age`. `seeJsonStructure` will only verify the structure as passed as the argument; if the `pet`would also have a `weight`, the test case will still pass.
237
+
The above example illustrates an expectation of receiving a `name` and a nested `pet` object with its own `name` and `age`. `seeJsonStructure` will not fail if additional keys are present in the response. For example, the test would still pass if the `pet`had a `weight` attribute.
0 commit comments