Пример #1
0
 /**
  * @test
  */
 public function shouldSendPostRequest()
 {
     $url = "http://foobar";
     $data = array("foo" => "bar");
     $stream = Mockery::mock('Psr\\Http\\Message\\StreamInterface');
     $stream->shouldReceive("getContents")->once()->with()->andReturn(json_encode($data));
     $jsonResponse = Mockery::mock('\\Psr\\Http\\Message\\ResponseInterface');
     $jsonResponse->shouldReceive("getBody")->once()->andReturn($stream);
     $this->guzzleClient->shouldReceive("request")->once()->andReturn($jsonResponse);
     $this->requestInvoker->post($url, $data);
 }