Append JSON_THROW_ON_ERROR on json_decode

This commit is contained in:
Julien Fastré 2024-01-15 20:59:11 +01:00
parent f5879cf275
commit b369d94bc3
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -30,7 +30,7 @@ class NewsItemApiControllerTest extends WebTestCase
$client->request('GET', '/api/1.0/main/news/current.json'); $client->request('GET', '/api/1.0/main/news/current.json');
$this->assertResponseIsSuccessful('Testing whether the GET request to the news item Api endpoint was successful'); $this->assertResponseIsSuccessful('Testing whether the GET request to the news item Api endpoint was successful');
$responseContent = json_decode($client->getResponse()->getContent(), true); $responseContent = json_decode($client->getResponse()->getContent(), true, 512, JSON_THROW_ON_ERROR);
if (!empty($responseContent['data'][0])) { if (!empty($responseContent['data'][0])) {
$this->assertArrayHasKey('title', $responseContent['data'][0]); $this->assertArrayHasKey('title', $responseContent['data'][0]);