15
15
use Symfony \Component \HttpClient \DataCollector \HttpClientDataCollector ;
16
16
use Symfony \Component \HttpClient \NativeHttpClient ;
17
17
use Symfony \Component \HttpClient \TraceableHttpClient ;
18
- use Symfony \Component \HttpFoundation \Request ;
19
- use Symfony \Component \HttpFoundation \Response ;
20
18
use Symfony \Contracts \HttpClient \Test \TestHttpServer ;
21
19
22
20
class HttpClientDataCollectorTest extends TestCase
@@ -50,7 +48,7 @@ public function testItCollectsRequestCount()
50
48
$ sut ->registerClient ('http_client2 ' , $ httpClient2 );
51
49
$ sut ->registerClient ('http_client3 ' , $ httpClient3 );
52
50
$ this ->assertEquals (0 , $ sut ->getRequestCount ());
53
- $ sut ->collect ( new Request (), new Response () );
51
+ $ sut ->lateCollect ( );
54
52
$ this ->assertEquals (3 , $ sut ->getRequestCount ());
55
53
}
56
54
@@ -79,7 +77,7 @@ public function testItCollectsErrorCount()
79
77
$ sut ->registerClient ('http_client2 ' , $ httpClient2 );
80
78
$ sut ->registerClient ('http_client3 ' , $ httpClient3 );
81
79
$ this ->assertEquals (0 , $ sut ->getErrorCount ());
82
- $ sut ->collect ( new Request (), new Response () );
80
+ $ sut ->lateCollect ( );
83
81
$ this ->assertEquals (1 , $ sut ->getErrorCount ());
84
82
}
85
83
@@ -108,7 +106,7 @@ public function testItCollectsErrorCountByClient()
108
106
$ sut ->registerClient ('http_client2 ' , $ httpClient2 );
109
107
$ sut ->registerClient ('http_client3 ' , $ httpClient3 );
110
108
$ this ->assertEquals ([], $ sut ->getClients ());
111
- $ sut ->collect ( new Request (), new Response () );
109
+ $ sut ->lateCollect ( );
112
110
$ collectedData = $ sut ->getClients ();
113
111
$ this ->assertEquals (0 , $ collectedData ['http_client1 ' ]['error_count ' ]);
114
112
$ this ->assertEquals (1 , $ collectedData ['http_client2 ' ]['error_count ' ]);
@@ -140,7 +138,7 @@ public function testItCollectsTracesByClient()
140
138
$ sut ->registerClient ('http_client2 ' , $ httpClient2 );
141
139
$ sut ->registerClient ('http_client3 ' , $ httpClient3 );
142
140
$ this ->assertEquals ([], $ sut ->getClients ());
143
- $ sut ->collect ( new Request (), new Response () );
141
+ $ sut ->lateCollect ( );
144
142
$ collectedData = $ sut ->getClients ();
145
143
$ this ->assertCount (2 , $ collectedData ['http_client1 ' ]['traces ' ]);
146
144
$ this ->assertCount (1 , $ collectedData ['http_client2 ' ]['traces ' ]);
@@ -157,7 +155,7 @@ public function testItIsEmptyAfterReset()
157
155
]);
158
156
$ sut = new HttpClientDataCollector ();
159
157
$ sut ->registerClient ('http_client1 ' , $ httpClient1 );
160
- $ sut ->collect ( new Request (), new Response () );
158
+ $ sut ->lateCollect ( );
161
159
$ collectedData = $ sut ->getClients ();
162
160
$ this ->assertCount (1 , $ collectedData ['http_client1 ' ]['traces ' ]);
163
161
$ sut ->reset ();
0 commit comments