onlyGuzzle5(); $this->mockPsr7Request = $this ->getMockBuilder('Psr\Http\Message\RequestInterface') ->getMock(); $this->mockRequest = $this ->getMockBuilder('GuzzleHttp\Message\RequestInterface') ->getMock(); $this->mockClient = $this ->getMockBuilder('GuzzleHttp\Client') ->disableOriginalConstructor() ->getMock(); } public function testSuccessfullySendsRequest() { $this->mockClient ->expects($this->any()) ->method('send') ->will($this->returnValue(new Response(200))); $this->mockClient ->expects($this->any()) ->method('createRequest') ->will($this->returnValue($this->mockRequest)); $handler = new Guzzle5HttpHandler($this->mockClient); $response = $handler($this->mockPsr7Request); $this->assertInstanceOf('Psr\Http\Message\ResponseInterface', $response); } }