Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function testSendRequest() |
||
18 | { |
||
19 | $request = new Request('GET', 'http://example.com'); |
||
20 | $response = new Response(200, [], 'test'); |
||
21 | |||
22 | $client = $this->createMock(ClientInterface::class); |
||
23 | $client->expects($this->once()) |
||
24 | ->method('sendRequest') |
||
25 | ->with($request) |
||
26 | ->willReturn($response); |
||
27 | $collector = new HttpClientCollector(new TimelineCollector()); |
||
28 | $collector->startup(); |
||
29 | |||
30 | $proxy = new HttpClientInterfaceProxy($client, $collector); |
||
31 | |||
32 | $newResponse = $proxy->sendRequest($request); |
||
33 | |||
34 | $this->assertSame($newResponse, $response); |
||
35 | $this->assertCount(1, $collector->getCollected()); |
||
36 | } |
||
38 |