Answer the question
In order to leave comments, you need to log in
How to set environment variable during acceptance test in codeception?
acceptance.suite.yml
actor: AcceptanceTester
modules:
enabled:
- WebDriver:
url: 'http://172.17.0.1:5011/'
browser: chrome
port: 4444
host: chrome
- Db:
dsn: 'mysql:host=mysql;dbname=db_test'
user: 'root'
password: '1234'
Answer the question
In order to leave comments, you need to log in
Your application in the test environment must connect to the test database. There is no magic if the application in its config sees the dev-base, and not the test one - it will (expectedly) connect to it, even if you really want the other way around and decided to look into some test database in the tests.
Total: Make the application look in the same database when running tests as the test framework
For Symfony, a couple of options:
- make a test domain that would be raised with a test Kernel
- raise the application with environment variables not through environment imitation in .env, but through the environment itself (roughly speaking, http://172.17.0.1
in the environment variables (not in the file imitating them .env) the connection parameters must be correct
- use Symfony module with explicit env: test, but suitable for functional tests, not acceptance tests
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question