public send ( Psr\Http\Message\RequestInterface $request, |
||
$request | Psr\Http\Message\RequestInterface | |
$messageFactory | ||
리턴 | PromiseInterface | Promise |
/** * @dataProvider provideRequestProtocolVersion */ public function testRequestProtocolVersion(Request $Request, $method, $uri, $headers, $protocolVersion) { $httpClientArguments = array(); $ref = new \ReflectionClass('React\\HttpClient\\Client'); if ($ref->getConstructor()->getNumberOfRequiredParameters() == 3) { $httpClientArguments[] = $this->getMock('React\\EventLoop\\LoopInterface'); } $httpClientArguments[] = $this->getMock('React\\SocketClient\\ConnectorInterface'); $httpClientArguments[] = $this->getMock('React\\SocketClient\\ConnectorInterface'); $http = $this->getMock('React\\HttpClient\\Client', array('request'), $httpClientArguments); $requestArguments = array(); $ref = new \ReflectionClass('React\\HttpClient\\Request'); if ($ref->getConstructor()->getNumberOfRequiredParameters() == 3) { $requestArguments[] = $this->getMock('React\\EventLoop\\LoopInterface'); } $requestArguments[] = $this->getMock('React\\SocketClient\\ConnectorInterface'); $requestArguments[] = new RequestData($method, $uri, $headers, $protocolVersion); $request = $this->getMock('React\\HttpClient\\Request', array(), $requestArguments); $http->expects($this->once())->method('request')->with($method, $uri, $headers, $protocolVersion)->willReturn($request); $sender = new Sender($http); $sender->send($Request, $this->getMock('Clue\\React\\Buzz\\Message\\MessageFactory')); }