Created
August 7, 2018 22:46
-
-
Save whoisryosuke/455ff79d334ba3338dc1f711da5e4e6a to your computer and use it in GitHub Desktop.
Laravel - Testing / API - Assert JSON structure (instead of values)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$response | |
->assertStatus(201) | |
->assertJsonStructure([ | |
'data' => [ | |
'id', | |
'business_id', | |
'user_id', | |
'verified', | |
'user_type', | |
'permissions', | |
'created_at', | |
'updated_at', | |
], | |
]); | |
// { | |
// data: { | |
// { | |
// id: "013b6658-3f49-40a9-b00c-f400c2fcdbd1", | |
// business_id: "4f0b5490-5b2c-11e8-b786-0905d3befa8e", | |
// user_id: "ed73dde3-25b6-4247-899c-c6862549b0dc", | |
// verified: 1, | |
// user_type: "representative", | |
// permissions: "[]", | |
// created_at: { | |
// date: "2018-08-07 21:04:24.000000", | |
// timezone_type: 3, | |
// timezone: "UTC" | |
// }, | |
// updated_at: { | |
// date: "2018-08-07 21:04:24.000000", | |
// timezone_type: 3, | |
// timezone: "UTC" | |
// }, | |
// }, | |
// } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment