Documentation unclear regarding environments
opened this issue · comments
The documentation says that you should update the kernel with the following code
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
...
$bundles[] = new Behat\BehatBundle\BehatBundle();
...
}
I actually only use Behat in my test environment, not dev. Regardless, this documentation appears to be wrong. Behat actually runs in an environment named 'behat'.
The first thing that happened when I tried to run
app/console --env behat
I was shown an invalid argument exception:
The file "/var/www/best-practice-with-symfony2-example/app/config/config_behat.yml" does not exist.
I think that it is probably a good idea to run behat in its own environment but the documentation needs to be updated to reflect this.
I have updated my kernel to the following code and it no longer raises the above exception:
if (in_array($this->getEnvironment(), array('dev', 'test', 'behat'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
if('behat' === $this->getEnvironment()) {
$bundles[] = new Behat\BehatBundle\BehatBundle();
}
I also needed to create a config_behat.yml file under app/config, which looks like the following:
imports:
- { resource: config_test.yml }
behat: ~
Documentation needs to be hugely updated. I'm planing to do it today ;-)