1515use Symfony \Component \HttpClient \DataCollector \HttpClientDataCollector ;
1616use Symfony \Component \HttpClient \NativeHttpClient ;
1717use Symfony \Component \HttpClient \TraceableHttpClient ;
18- use Symfony \Component \HttpFoundation \Request ;
19- use Symfony \Component \HttpFoundation \Response ;
2018use Symfony \Contracts \HttpClient \Test \TestHttpServer ;
2119
2220class HttpClientDataCollectorTest extends TestCase
@@ -50,7 +48,7 @@ public function testItCollectsRequestCount()
5048 $ sut ->registerClient ('http_client2 ' , $ httpClient2 );
5149 $ sut ->registerClient ('http_client3 ' , $ httpClient3 );
5250 $ this ->assertEquals (0 , $ sut ->getRequestCount ());
53- $ sut ->collect ( new Request (), new Response () );
51+ $ sut ->lateCollect ( );
5452 $ this ->assertEquals (3 , $ sut ->getRequestCount ());
5553 }
5654
@@ -79,7 +77,7 @@ public function testItCollectsErrorCount()
7977 $ sut ->registerClient ('http_client2 ' , $ httpClient2 );
8078 $ sut ->registerClient ('http_client3 ' , $ httpClient3 );
8179 $ this ->assertEquals (0 , $ sut ->getErrorCount ());
82- $ sut ->collect ( new Request (), new Response () );
80+ $ sut ->lateCollect ( );
8381 $ this ->assertEquals (1 , $ sut ->getErrorCount ());
8482 }
8583
@@ -108,7 +106,7 @@ public function testItCollectsErrorCountByClient()
108106 $ sut ->registerClient ('http_client2 ' , $ httpClient2 );
109107 $ sut ->registerClient ('http_client3 ' , $ httpClient3 );
110108 $ this ->assertEquals ([], $ sut ->getClients ());
111- $ sut ->collect ( new Request (), new Response () );
109+ $ sut ->lateCollect ( );
112110 $ collectedData = $ sut ->getClients ();
113111 $ this ->assertEquals (0 , $ collectedData ['http_client1 ' ]['error_count ' ]);
114112 $ this ->assertEquals (1 , $ collectedData ['http_client2 ' ]['error_count ' ]);
@@ -140,7 +138,7 @@ public function testItCollectsTracesByClient()
140138 $ sut ->registerClient ('http_client2 ' , $ httpClient2 );
141139 $ sut ->registerClient ('http_client3 ' , $ httpClient3 );
142140 $ this ->assertEquals ([], $ sut ->getClients ());
143- $ sut ->collect ( new Request (), new Response () );
141+ $ sut ->lateCollect ( );
144142 $ collectedData = $ sut ->getClients ();
145143 $ this ->assertCount (2 , $ collectedData ['http_client1 ' ]['traces ' ]);
146144 $ this ->assertCount (1 , $ collectedData ['http_client2 ' ]['traces ' ]);
@@ -157,7 +155,7 @@ public function testItIsEmptyAfterReset()
157155 ]);
158156 $ sut = new HttpClientDataCollector ();
159157 $ sut ->registerClient ('http_client1 ' , $ httpClient1 );
160- $ sut ->collect ( new Request (), new Response () );
158+ $ sut ->lateCollect ( );
161159 $ collectedData = $ sut ->getClients ();
162160 $ this ->assertCount (1 , $ collectedData ['http_client1 ' ]['traces ' ]);
163161 $ sut ->reset ();
0 commit comments