-
I have a
Now after starting the test, this error appears: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
For such tests, I added a method to decode JSON (in a trait). trait JsonResponse
{
protected function getResponseContent(): array
{
return json_decode($this->client->getResponse()->getContent(), true);
}
} |
Beta Was this translation helpful? Give feedback.
assertArrayHasKey
not worked because$response
type is string and when you convert it to array, the key of that is0
.So you can use
assertStringContainsString
like this:$this->assertStringContainsString('firstName', $response);