Skip to content

Instantly share code, notes, and snippets.

@jminkler
Created February 13, 2019 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jminkler/7212dbea4aa92df5efc7fedddb69c291 to your computer and use it in GitHub Desktop.
Save jminkler/7212dbea4aa92df5efc7fedddb69c291 to your computer and use it in GitHub Desktop.
Guzzle Mock Responses
use GuzzleHttp\Psr7\Response;
$string = json_encode(['data' => 'test']);
$response = new Response(200, ['Content-Type' => 'application/json'], $string);
use Guzzle\Http\Message\Response;
$body = '<html><body>Hello world!</body></html>';
$response = new Response(200, ['X-Foo' => 'Bar'], $body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment