@@ -74,7 +74,7 @@ public static function stopWebServer(): void
74
74
}
75
75
76
76
if (null !== self ::$ pantherClient ) {
77
- foreach (self ::$ pantherClients as $ i => $ pantherClient ) {
77
+ foreach (self ::$ pantherClients as $ pantherClient ) {
78
78
// Stop ChromeDriver only when all sessions are already closed
79
79
$ pantherClient ->quit (false );
80
80
}
@@ -178,16 +178,21 @@ protected static function createPantherClient(array $options = [], array $kernel
178
178
179
179
self ::startWebServer ($ options );
180
180
181
+ $ browserArguments = $ options ['browser_arguments ' ] ?? null ;
182
+ if (null !== $ browserArguments && !\is_array ($ browserArguments )) {
183
+ throw new \TypeError (sprintf ('Expected key "browser_arguments" to be an array or null, "%s" given. ' , get_debug_type ($ browserArguments )));
184
+ }
185
+
181
186
if (PantherTestCase::FIREFOX === $ browser ) {
182
- self ::$ pantherClients [0 ] = self ::$ pantherClient = Client::createFirefoxClient (null , null , $ managerOptions , self ::$ baseUri );
187
+ self ::$ pantherClients [0 ] = self ::$ pantherClient = Client::createFirefoxClient (null , $ browserArguments , $ managerOptions , self ::$ baseUri );
183
188
} else {
184
189
try {
185
- self ::$ pantherClients [0 ] = self ::$ pantherClient = Client::createChromeClient (null , null , $ managerOptions , self ::$ baseUri );
190
+ self ::$ pantherClients [0 ] = self ::$ pantherClient = Client::createChromeClient (null , $ browserArguments , $ managerOptions , self ::$ baseUri );
186
191
} catch (\RuntimeException $ e ) {
187
192
if (PantherTestCase::CHROME === $ browser ) {
188
193
throw $ e ;
189
194
}
190
- self ::$ pantherClients [0 ] = self ::$ pantherClient = Client::createFirefoxClient (null , null , $ managerOptions , self ::$ baseUri );
195
+ self ::$ pantherClients [0 ] = self ::$ pantherClient = Client::createFirefoxClient (null , $ browserArguments , $ managerOptions , self ::$ baseUri );
191
196
}
192
197
193
198
if (null === $ browser ) {
@@ -229,9 +234,14 @@ protected static function createHttpBrowserClient(array $options = [], array $ke
229
234
self ::startWebServer ($ options );
230
235
231
236
if (null === self ::$ httpBrowserClient ) {
232
- // The ScopingHttpClient cant't be used cause the HttpBrowser only supports absolute URLs,
237
+ $ httpClientOptions = $ options ['http_client_options ' ] ?? [];
238
+ if (!\is_array ($ httpClientOptions )) {
239
+ throw new \TypeError (sprintf ('Expected key "http_client_options" to be an array, "%s" given. ' , get_debug_type ($ httpClientOptions )));
240
+ }
241
+
242
+ // The ScopingHttpClient can't be used cause the HttpBrowser only supports absolute URLs,
233
243
// https://github.com/symfony/symfony/pull/35177
234
- self ::$ httpBrowserClient = new HttpBrowserClient (HttpClient::create ());
244
+ self ::$ httpBrowserClient = new HttpBrowserClient (HttpClient::create ($ httpClientOptions ));
235
245
}
236
246
237
247
if (is_a (self ::class, KernelTestCase::class, true )) {
0 commit comments