From 905e8ea4bc3dc535785abc7e2ca8859d5ea09aa9 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Mon, 30 Dec 2013 09:22:18 -0500 Subject: [PATCH] Fixes #1701. --- config/web.php | 7 ------- tests/_bootstrap.php | 2 +- tests/_config.php | 11 +++++++++++ tests/acceptance/_config.php | 29 ++++++++++++++++------------- tests/functional/_config.php | 29 ++++++++++++++++------------- tests/unit/_config.php | 28 ++++++++++++++-------------- 6 files changed, 58 insertions(+), 48 deletions(-) create mode 100644 tests/_config.php 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', - ], - ], -]); + ] +);