Closed HenryVolkmer closed 4 years ago
Shouldn't those modules have their own config file? If the code is modular then the tests can be too. That way you can test the modules separately in their own repo.
I have the same issue (but my modules are in a mono repo) so I use a relative path (ie the codeception file does have knowledge of the directory structure of the parent; I agree that this is currently an issue.
I am not a fan of your proposed solution though; since it means module specific adaptations for a generic problem. A cleaner solution, in my opinion would be variable support in the yaml files.
This way you could have a variable defined in your primary codeception file and your codeception.dist.yml
in the module can use this variable.
Note that the parser we use (symfony/yaml) already supports key merging so extending this to support the included files could be relatively simple
Also there is a --config-option
param that might be of use to you.
i understand your point, ty for your feedback! This manual also solved this issue.
Btw, i cant find an --config-option
param in the Codeception-Docs, can you please provide a Link?
Btw, i cant find an
--config-option
param in the Codeception-Docs, can you please provide a Link?
I can't, just noticed it in the source while replying to your post. So not sure if there are docs, if you can't find them I'm not going to try looking for them either ;-) Glad you have your issue solved!
Proposal
What are you trying to achieve?
my application consists through reuseable Yii2-Modules, packed as independend composer packages, residing in
vendor/
-Folder. E.g.:Each Yii2-Module utilize the
codeception/module-yii2
in order to provide Tests. Further, each Module provides acodeception.yml
-Configfile and obviosly Module-specific tests. In order to test an Application against all currently installed Modules, the Application provides also acodeception.yml
-Configfile whith ainclude
-Section:All Modules configured in the
include
-Key should be included for testing.What do you get instead?
Since a particular Module knows nothing about the current deployed Application and config-paths, i CAN NOT provide the
configFile
-Key in Module'scodeception.yml
. Therefore, a ModuleConfigException will be thrown:proposed Changes (non breaking):
In current Version of Yii2.php, the
configFile
-Configuration MUST BE set by each Suite.I propose to recognisize a Key
Yii2ConfigFile
(string) in the$_SERVER
-var and make it possible to additionaly configure theconfigFile
via codeception's--bootstrap
parameter:run tests:
vendor/bin/codeception run --bootstrap='test/codeception-bootstrap.php'
test/codeception-bootstrap.php:
codeception-local.php:
implementation
Required Changes in Yii2.php
related issues