Ejemplo n.º 1
0
 public function testSendShouldCreateRequestAndSendIt()
 {
     /** @var RequestInterface|PHPUnit_Framework_MockObject_MockObject $httpRequest */
     $httpRequest = $this->getMockBuilder(RequestInterface::class)->getMock();
     /** @var GuzzleClient|PHPUnit_Framework_MockObject_MockObject $httpClient */
     $httpClient = $this->getMockBuilder(GuzzleClient::class)->disableOriginalConstructor()->getMock();
     $httpClient->expects($this->once())->method('createRequest')->willReturn($httpRequest);
     $httpClient->expects($this->once())->method('send')->with($this->isInstanceOf(RequestInterface::class))->willReturn($this->getMockForAbstractClass(ResponseInterface::class));
     $request = new Request('/', self::BODY);
     $client = new Client($httpClient);
     $client->send($request);
 }