for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace CanalTP\AbstractGuzzle\Tests\Mock;
use CanalTP\AbstractGuzzle\GuzzleFactory;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\HandlerStack;
class Guzzle6Mock extends \PHPUnit_Framework_TestCase
{
/**
* Guzzle6Mock constructor.
*/
* @param array $responseCollection new Response(200, ['X-Foo' => 'Bar']),
new Response(202, ['Content-Length' => 0]),
new RequestException("Error Communicating with Server", new Request('GET', 'test'))
public function __construct(array $responseCollection)
$mock = new MockHandler($responseCollection);
$handler = HandlerStack::create($mock);
return GuzzleFactory::createGuzzle('', ['handler' => $handler]);
}