diff --git a/http_client.rst b/http_client.rst index 9e9a74b973b..9cd9b80208c 100644 --- a/http_client.rst +++ b/http_client.rst @@ -2192,12 +2192,13 @@ test it in a real application:: // ... other checks $responseJson = $response->getContent(); - $responseData = json_decode($responseJson, true, 512, JSON_THROW_ON_ERROR); - return $responseData; + return json_decode($responseJson, true, 512, JSON_THROW_ON_ERROR); } } +.. code-block:: php + // ExternalArticleServiceTest.php use PHPUnit\Framework\TestCase; use Symfony\Component\HttpClient\MockHttpClient;