I really like how the Advanced application template handles the configs and environments. It really helps when working in a team.
Unfortunately the configuration for Codeception tests isn’t structured in a same way. So unless some modifications are made absolute URLs and DB configs are stored in the repository.
I suppose I’m not the first one to run into this issue. Do you have any tips/best practices on how to handle the configuration of tests in an elegant way?
I would argue that it is structured similarly. Under tests/codeception/config you have a dir for backend, common, console and frontend. You can override things there in the same way as with the web app. It includes all the config files, eg here is the frontend/unit.php
So its easy to override things you want to change in the test environment, eg db settings
You are right that the structure is similar when it comes to separating frontend, backend, etc. What I meant is that the main application has global configs that are stored in the repository and local configs that are stored only locally. In tests codeception\config\config.php is already a part of the template, not the local file and there are also YML configs that contains absolute URLs.
I have the general idea how to modify the structure of tests in a similar way. I just wanted to check how others cope with it in their projects.
I think it would make sense to make the tests “repository-friendly” in the application itself but perhaps I’m missing some point so I rather opened this topic before posting feature suggestion.
Just in case somebody faces the same problem I’m posting my solution here:
[list=1]
[*]I moved YML configs used by codeception to the environments/dev/ to get them copied during the init. Also I marked them as untracked for the repository.
[*]I added config-local.php to tests/codeception/config/ to hold local params (DB connection etc.).
[*]Then I modified other configs to include the new config-local.php file.