diff --git a/config/web.php b/config/web.php index e142855..67c056b 100644 --- a/config/web.php +++ b/config/web.php @@ -47,11 +47,4 @@ if (YII_ENV_DEV) { $config['modules']['gii'] = 'yii\gii\Module'; } -if (YII_ENV_TEST) { - // configuration adjustments for 'test' environment. - // configuration for codeception test environments can be found in codeception folder. - - // if needed, customize $config here. -} - return $config; diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 5a40d64..07e86c7 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -2,7 +2,7 @@ // the entry script URL (without host info) for functional and acceptance tests // PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL -defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/yii2-basic/web/index-test.php'); +defined('TEST_ENTRY_URL') or define('TEST_ENTRY_URL', '/basic/web/index-test.php'); // the entry script file path for functional and acceptance tests defined('TEST_ENTRY_FILE') or define('TEST_ENTRY_FILE', dirname(__DIR__) . '/web/index-test.php'); diff --git a/tests/_config.php b/tests/_config.php new file mode 100644 index 0000000..06245f4 --- /dev/null +++ b/tests/_config.php @@ -0,0 +1,11 @@ + [ + 'mail' => [ + 'useFileTransport' => true, + ], + ], +]; diff --git a/tests/acceptance/_config.php b/tests/acceptance/_config.php index 8979253..48f3f16 100644 --- a/tests/acceptance/_config.php +++ b/tests/acceptance/_config.php @@ -1,16 +1,19 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', +return yii\helpers\ArrayHelper::merge( + require(__DIR__ . '/../../config/web.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', + ], + 'mail' => [ + 'useFileTransport' => true, + ], + 'urlManager' => [ + 'showScriptName' => true, + ], ], - 'urlManager' => [ - 'showScriptName' => true, - ], - ], -]); + ] +); diff --git a/tests/functional/_config.php b/tests/functional/_config.php index bb93d96..1234c67 100644 --- a/tests/functional/_config.php +++ b/tests/functional/_config.php @@ -1,20 +1,23 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', +return yii\helpers\ArrayHelper::merge( + require(__DIR__ . '/../../config/web.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', + ], + 'mail' => [ + 'useFileTransport' => true, + ], + 'urlManager' => [ + 'showScriptName' => true, + ], ], - 'urlManager' => [ - 'showScriptName' => true, - ], - ], -]); + ] +); diff --git a/tests/unit/_config.php b/tests/unit/_config.php index 6eac4f9..e9c3fb3 100644 --- a/tests/unit/_config.php +++ b/tests/unit/_config.php @@ -1,17 +1,17 @@ [ - 'fixture' => [ - 'class' => 'yii\test\DbFixtureManager', - 'basePath' => '@tests/unit/fixtures', +return yii\helpers\ArrayHelper::merge( + require(__DIR__ . '/../../config/web.php'), + require(__DIR__ . '/../_config.php'), + [ + 'components' => [ + 'fixture' => [ + 'class' => 'yii\test\DbFixtureManager', + 'basePath' => '@tests/unit/fixtures', + ], + 'db' => [ + 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', + ], ], - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', - ], - ], -]); + ] +);