I’m using Advanced template and its default structure of the test folder
I’m writing a unit test (tests/codeception/common/unit/models/…) of a method that uses one of config params
$min_median = Yii::$app->params['min_median'];
which is set in common/config/params.php
When running the test I get
yii\base\ErrorException: Undefined index: min_median
that is it doesn’t load the configs
How can I bootstrap the test enviroment to load them?
SOLUTION:
$params should be included and added to the config which is used for tests - tests/codeception/config/config.php
<?php
$params = array_merge(
require(__DIR__ . '/../../../common/config/params.php'), require(__DIR__ . '/../../../common/config/params-local.php')
);
return [
...
'components' => [
...
],
'params' => $params,
];