| 1 | <?php |
||
| 11 | class TestCase extends \PHPUnit_Framework_TestCase |
||
| 12 | { |
||
| 13 | protected function setUp() |
||
| 14 | { |
||
| 15 | parent::setUp(); |
||
| 16 | } |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param $responseBody |
||
| 20 | * |
||
| 21 | * @return \Prophecy\Prophecy\ObjectProphecy |
||
| 22 | */ |
||
| 23 | protected function getFakeResponse($responseBody) |
||
| 24 | { |
||
| 25 | |||
| 26 | $fakeResponse = $this->prophesize(Response::class); |
||
| 27 | $stream = $this->prophesize(Stream::class); |
||
| 28 | $stream->getContents()->willReturn($responseBody); |
||
| 29 | $stream->rewind()->willReturn(null)->shouldBeCalled(); |
||
| 30 | $fakeResponse->getBody()->willReturn($stream->reveal()); |
||
| 31 | |||
| 32 | return $fakeResponse; |
||
| 33 | |||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | |||
| 38 | |||
| 39 | } |
||
| 40 |