Skip to content

Problem with test a json page #44314

Answered by BahmanMD
karaka200 asked this question in Q&A
Nov 28, 2021 · 3 comments · 3 replies
Discussion options

You must be logged in to vote

assertArrayHasKey not worked because $response type is string and when you convert it to array, the key of that is 0.
So you can use assertStringContainsString like this:

$this->assertStringContainsString('firstName', $response);

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@karaka200
Comment options

Answer selected by karaka200
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@stof
Comment options

@stloc
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants