Skip to content

Commit

Permalink
https://github.com/Behat/Symfony2Extension/pull/124
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Müller committed Mar 5, 2019
1 parent d7c8344 commit 9b030b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Behat/Symfony2Extension/Driver/KernelDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Behat\Symfony2Extension\Driver;

use Behat\Mink\Driver\BrowserKitDriver;
use Symfony\Component\HttpKernel\Client;
use Symfony\Component\HttpKernel\KernelInterface;

/**
Expand All @@ -21,8 +22,9 @@
*/
class KernelDriver extends BrowserKitDriver
{
public function __construct(KernelInterface $kernel, $baseUrl = null)
public function __construct(KernelInterface $kernel, $baseUrl = null, $shared = false)
{
parent::__construct($kernel->getContainer()->get('test.client'), $baseUrl);
$client = $shared === true ? new Client($kernel) : $kernel->getContainer()->get('test.client');
parent::__construct($client, $baseUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function buildDriver(array $config)
return new Definition('Behat\Symfony2Extension\Driver\KernelDriver', array(
new Reference(Symfony2Extension::KERNEL_ID),
'%mink.base_url%',
'%symfony2_extension.kernel.shared%'
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ public function configure(ArrayNodeDefinition $builder)
->end()
->defaultTrue()
->end()
->booleanNode('shared')
->beforeNormalization()
->ifString()->then($boolFilter)
->end()
->defaultFalse()
->end()
->end()
->end()
->arrayNode('context')
Expand Down Expand Up @@ -181,6 +187,7 @@ private function loadKernel(ContainerBuilder $container, array $config)
$container->setDefinition(self::KERNEL_ID, $definition);
$container->setParameter(self::KERNEL_ID . '.path', $config['path']);
$container->setParameter(self::KERNEL_ID . '.bootstrap', $config['bootstrap']);
$container->setParameter(self::KERNEL_ID . '.shared', $config['shared']);
}

private function loadSuiteGenerator(ContainerBuilder $container, array $config)
Expand Down

0 comments on commit 9b030b5

Please sign in to comment.