Behat/Symfony2Extension — pull request #29 by Taluu (2013-04-11 09:52:24+00:00)
Title: Register symfony2 session only if test environment

Hi,

Although the extension allows you to switch at your own convenience in your behat configuration the environment for the kernel :

```yaml
# ...
kernel;
env: prod|test|dev|...
```

You can't really do it if you're already using `Mink` and `BrowserKitDriver` (or `GoutteDriver`, or any drivers that extends the BrowserDriver actually), or setting the `mink_loader` parameter to `true`. In some cases, you may need to have your app kernel, but not necessarly with the `KernelDriver` that is shipped with this extension (as it uses the `test.client`, which is not registered in Symfony2 unless you load the `test` parameter in the `FrameworkBundle` config).

That is why I think that the section registering the driver should be optionnal, if the kernel is not in a testing environment. Yes, I know that the environment name may change, or that I am not really controlling if the `default_session` of Mink is not `symfony2`, but that's all I found to prevent the driver from loading if not in test environment... If you have any suggestions to cover this, please feel free to tell.

Cheers.