mercredi 10 avril 2019

Laravel AssertJsonCount on a nested array

How can I call assertJsonCount using an indexed, nested array?

In my test, the following JSON is returned:

[[{"sku":"P09250"},{"sku":"P03293"}]]

But attempting to use assertJsonCount returns the following error:

$response->assertJsonCount(2);

// Failed asserting that actual size 1 matches expected size 2.

Aucun commentaire:

Enregistrer un commentaire