Codeception: [Bug] Parameters token replacement in suites not inherited from main config

Created on 14 Jun 2016  路  4Comments  路  Source: Codeception/Codeception

When module parameters with replacement tokens are defined in the main codeception.yml they are inherited from the suite, but no replacement will occur.

The configuration has to be moved to the suite(s) in order to token replacement to work.
In my opinion the variable replacement should occur again within each suite (in case params were added / modified). If no parameters changes were made, the original parameters should be used.

codeception.yml:

params:
    - env
    - ../../app/config/parameters.yml

modules:
    config:
        Db:
            # won't work as the module will receive the unreplaced string
            dsn: "mysql:host=%database.host%;dbname=%database.name%"
            user: '%database.user%'
            password: '%database.password%'
            dump: Tests/_data/dump.sql
            populate: true
            cleanup: false
            reconnect: true

functional.suite.yml:

class_name: FunctionalTester
modules:
    enabled:
        - Asserts
        - Symfony:
           environment: 'test'
           var_path: '../../app'
           app_path: '../../app'
        - Db:
            # required for token replacement
            dsn: "mysql:host=%database.host%;dbname=%database.name%"
            user: '%database.user%'
            password: '%database.password%'
BUG Hacktoberfest

Most helpful comment

Any progress on this?

All 4 comments

I see that in version 2.2.9 params loading from app/config/parameters.yml works only in codeception.yml or codeception.dist.yml, but not in unit.suite.yml or any other suite. The problem not fixed. In #3255 problem was that params work only in suite yml files and dont work in main codeception.yml. Now it is vise versa :(

Any progress on this?

This issue remains apparently : I need to put parameters from parameters.yml into acceptance.suite.yml but imports do not work. Or is there a workaround ?

Was this page helpful?
0 / 5 - 0 ratings