From 05736e998e6f006d64e82409fd189d80bf268148 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Tue, 2 Nov 2021 11:21:22 -0400 Subject: [PATCH] [minor] allow setting server parameters to kernel browser --- src/Browser/Test/HasBrowser.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Browser/Test/HasBrowser.php b/src/Browser/Test/HasBrowser.php index 0e8ef39..85d82a8 100644 --- a/src/Browser/Test/HasBrowser.php +++ b/src/Browser/Test/HasBrowser.php @@ -113,7 +113,7 @@ protected function httpBrowser(array $kernelOptions = [], array $pantherOptions ; } - protected function browser(array $options = []): KernelBrowser + protected function browser(array $kernelOptions = [], array $server = []): KernelBrowser { if (!$this instanceof KernelTestCase) { throw new \RuntimeException(\sprintf('The "%s" method can only be used on TestCases that extend "%s".', __METHOD__, KernelTestCase::class)); @@ -128,16 +128,19 @@ protected function browser(array $options = []): KernelBrowser if ($this instanceof WebTestCase) { static::ensureKernelShutdown(); - $browser = new $class(static::createClient($options)); + $browser = new $class(static::createClient($kernelOptions, $server)); } else { // reboot kernel before starting browser - static::bootKernel($options); + static::bootKernel($kernelOptions); if (!static::$container->has('test.client')) { throw new \RuntimeException('The Symfony test client is not enabled.'); } - $browser = new $class(static::$container->get('test.client')); + $client = static::$container->get('test.client'); + $client->setServerParameters($server); + + $browser = new $class($client); } BrowserExtension::registerBrowser($browser);