From 0766ddca12a8171c7c83eb091122609cd1214b96 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 30 Dec 2013 09:22:18 -0500 Subject: [PATCH] Fixes #1701. --- apps/basic/config/web.php | 7 ------- apps/basic/tests/_bootstrap.php | 2 +- apps/basic/tests/_config.php | 11 +++++++++++ apps/basic/tests/acceptance/_config.php | 29 ++++++++++++++++------------- apps/basic/tests/functional/_config.php | 29 ++++++++++++++++------------- apps/basic/tests/unit/_config.php | 28 ++++++++++++++-------------- 6 files changed, 58 insertions(+), 48 deletions(-) create mode 100644 apps/basic/tests/_config.php diff --git a/apps/basic/config/web.php b/apps/basic/config/web.php index e142855..67c056b 100644 --- a/apps/basic/config/web.php +++ b/apps/basic/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/apps/basic/tests/_bootstrap.php b/apps/basic/tests/_bootstrap.php index 5a40d64..07e86c7 100644 --- a/apps/basic/tests/_bootstrap.php +++ b/apps/basic/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/apps/basic/tests/_config.php b/apps/basic/tests/_config.php new file mode 100644 index 0000000..06245f4 --- /dev/null +++ b/apps/basic/tests/_config.php @@ -0,0 +1,11 @@ + [ + 'mail' => [ + 'useFileTransport' => true, + ], + ], +]; diff --git a/apps/basic/tests/acceptance/_config.php b/apps/basic/tests/acceptance/_config.php index 8979253..48f3f16 100644 --- a/apps/basic/tests/acceptance/_config.php +++ b/apps/basic/tests/acceptance/_config.php @@ -1,16 +1,19 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_acceptance', - ], - 'urlManager' => [ - 'showScriptName' => true, +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, + ], ], - ], -]); + ] +); diff --git a/apps/basic/tests/functional/_config.php b/apps/basic/tests/functional/_config.php index bb93d96..1234c67 100644 --- a/apps/basic/tests/functional/_config.php +++ b/apps/basic/tests/functional/_config.php @@ -1,20 +1,23 @@ [ - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_functional', - ], - 'urlManager' => [ - 'showScriptName' => true, +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, + ], ], - ], -]); + ] +); diff --git a/apps/basic/tests/unit/_config.php b/apps/basic/tests/unit/_config.php index 6eac4f9..e9c3fb3 100644 --- a/apps/basic/tests/unit/_config.php +++ b/apps/basic/tests/unit/_config.php @@ -1,17 +1,17 @@ [ - 'fixture' => [ - 'class' => 'yii\test\DbFixtureManager', - 'basePath' => '@tests/unit/fixtures', - ], - 'db' => [ - 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_unit', +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', + ], ], - ], -]); + ] +);