samedi 3 septembre 2016

Testing an array in laravel phpunit

I have an array output in laravel, the structure looks like follows:

array:1 [
  0 => {#35
    +"id": 152
    +"user_id": 123
    +"post_id": 456
    +"content": "impedit"
    +"created_at": "04-09-2016 01:24"
    +"updated_at": "2016-09-04 01:24:51"
  }
]

How to test the array structure contains keys iduser_id ...?

I tried assertArrayHasKey('user_id', $array),but it shows failed. Thanks.

Aucun commentaire:

Enregistrer un commentaire