public function setUp()
{
// Create default HandlerStack
$stack = HandlerStack::create(function (RequestInterface $request, array $options) {
if ($request->getUri()->getPath() === '/no-seek') {
return new FulfilledPromise((new Response())->withBody(new NoSeekStream(\GuzzleHttp\Psr7\stream_for('I am not seekable!')))->withHeader('Expires', gmdate('D, d M Y H:i:s T', time() + 120)));
}
return new FulfilledPromise((new Response())->withBody(\GuzzleHttp\Psr7\stream_for('Hello world!'))->withHeader('Expires', gmdate('D, d M Y H:i:s T', time() + 120)));
});
// Add this middleware to the top with `push`
$stack->push(new CacheMiddleware(), 'cache');
// Initialize the client with the handler option
$this->client = new Client(['handler' => $stack]);
}