@@ -51,7 +51,7 @@ public function constructorThrowsExceptionForEmptyBaseUrl(): void
5151 public function constructorWrapsHttpClientInEventSourceHttpClient (): void
5252 {
5353 $ mockHttpClient = new MockHttpClient ();
54-
54+
5555 $ client = new GPTModelClient (
5656 $ mockHttpClient ,
5757 'test-api-key ' ,
@@ -74,7 +74,7 @@ public function constructorAcceptsEventSourceHttpClient(): void
7474 {
7575 $ mockHttpClient = new MockHttpClient ();
7676 $ eventSourceClient = new EventSourceHttpClient ($ mockHttpClient );
77-
77+
7878 $ client = new GPTModelClient (
7979 $ eventSourceClient ,
8080 'test-api-key ' ,
@@ -124,6 +124,7 @@ public function requestSendsCorrectHttpRequest(array|string $payload, array $opt
124124 $ capturedRequest = null ;
125125 $ httpClient = new MockHttpClient (function ($ method , $ url , $ options ) use (&$ capturedRequest ) {
126126 $ capturedRequest = ['method ' => $ method , 'url ' => $ url , 'options ' => $ options ];
127+
127128 return new JsonMockResponse (['choices ' => []]);
128129 });
129130
@@ -142,7 +143,7 @@ public function requestSendsCorrectHttpRequest(array|string $payload, array $opt
142143 self ::assertArrayHasKey ('normalized_headers ' , $ capturedRequest ['options ' ]);
143144 self ::assertArrayHasKey ('authorization ' , $ capturedRequest ['options ' ]['normalized_headers ' ]);
144145 self ::assertStringContainsString ('Bearer test-api-key ' , $ capturedRequest ['options ' ]['normalized_headers ' ]['authorization ' ][0 ]);
145-
146+
146147 // Check JSON body - it might be in 'body' after processing
147148 if (isset ($ capturedRequest ['options ' ]['body ' ])) {
148149 $ actualJson = json_decode ($ capturedRequest ['options ' ]['body ' ], true );
@@ -191,6 +192,7 @@ public function requestHandlesBaseUrlWithoutTrailingSlash(): void
191192 $ capturedUrl = null ;
192193 $ httpClient = new MockHttpClient (function ($ method , $ url ) use (&$ capturedUrl ) {
193194 $ capturedUrl = $ url ;
195+
194196 return new JsonMockResponse (['choices ' => []]);
195197 });
196198
@@ -212,6 +214,7 @@ public function requestHandlesBaseUrlWithTrailingSlash(): void
212214 $ capturedUrl = null ;
213215 $ httpClient = new MockHttpClient (function ($ method , $ url ) use (&$ capturedUrl ) {
214216 $ capturedUrl = $ url ;
217+
215218 return new JsonMockResponse (['choices ' => []]);
216219 });
217220
@@ -226,4 +229,4 @@ public function requestHandlesBaseUrlWithTrailingSlash(): void
226229
227230 self ::assertSame ('https://albert.example.com/v1/chat/completions ' , $ capturedUrl );
228231 }
229- }
232+ }
0 commit comments