/** * @expectedException \GuzzleHttp5Legacy\Exception\ParseException * @expectedExceptionMessage Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON */ public function testThrowsExceptionWhenFailsToParseJsonResponse() { $response = new Response(200, [], Stream::factory('{"foo": "')); $response->json(); }