Symfony2Extension icon indicating copy to clipboard operation
Symfony2Extension copied to clipboard

Allow setting symfony env per-suite

Open ciaranmcnulty opened this issue 7 years ago • 5 comments

Currently I'm using a 2-layer approach:

  • Injecting symfony services to the context with fake infrastructure
  • Doing end-to-end tests with symfony driver and real infrastructure

It's currently not possible (I think) to arrange these in suites because the symfony env is set at the extension level.

It'd be great to be able to set this at the suite level instead / as well

ciaranmcnulty avatar Nov 14 '17 10:11 ciaranmcnulty

I second this, as I had similar problem, and resorted to using different profiles rather than suites as they allow setting kernel env. having this option at the suite level would make sense.

jon-acker avatar Nov 15 '17 09:11 jon-acker

Yep, agree with this as well 👍 😉

sroze avatar Nov 15 '17 09:11 sroze

any news on this?

How are you running your behat tests with APP_ENV=test ? Is it possible somehow (without copying the index.php to index_test.php?

OskarStark avatar Jun 06 '18 05:06 OskarStark

@OskarStark No idea with dotenv

ciaranmcnulty avatar Jun 19 '18 15:06 ciaranmcnulty

@OskarStark @ciaranmcnulty I made it work using this configuration for Symfony2Extension:

default:
    extensions:
        Behat\Symfony2Extension:
            kernel:
                bootstrap: 'config/bootstrap.php' # used to load the dotenv configuration in replacement of app/autoload.php
                env: 'test' # does not seems to work as everything is manager by APP_ENV now
                debug: 'true'
                path: 'src/Kernel.php' # previously was AppKernel.php
                class: 'App\Kernel' # previously was `AppKernel`

and by running:

APP_ENV=test behat

jdeniau avatar Jan 22 '19 20:01 jdeniau