From 628caf85b9b7c70bd442393ac353b2a06a7cb25a Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Wed, 18 Dec 2013 00:40:52 -0500 Subject: [PATCH] test refactoring. --- commands/HelloController.php | 2 +- config/web.php | 6 ++---- tests/unit/_bootstrap.php | 4 ++-- web/index-test-acceptance.php | 5 ++--- web/index.php | 3 +-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/commands/HelloController.php b/commands/HelloController.php index b62e5bb..ce567dd 100644 --- a/commands/HelloController.php +++ b/commands/HelloController.php @@ -25,6 +25,6 @@ class HelloController extends Controller */ public function actionIndex($message = 'hello world') { - echo $message."\n"; + echo $message . "\n"; } } diff --git a/config/web.php b/config/web.php index 966458d..472f842 100644 --- a/config/web.php +++ b/config/web.php @@ -39,16 +39,14 @@ $config = [ 'params' => $params, ]; -if (YII_ENV_DEV) -{ +if (YII_ENV_DEV) { // configuration adjustments for 'dev' environment $config['preload'][] = 'debug'; $config['modules']['debug'] = 'yii\debug\Module'; $config['modules']['gii'] = 'yii\gii\Module'; } -if (YII_ENV_TEST) -{ +if (YII_ENV_TEST) { // configuration adjustments for 'test' environment. // configuration for codeception test environments can be found in codeception folder. diff --git a/tests/unit/_bootstrap.php b/tests/unit/_bootstrap.php index d6d11e9..f37625b 100644 --- a/tests/unit/_bootstrap.php +++ b/tests/unit/_bootstrap.php @@ -2,7 +2,7 @@ // add unit testing specific bootstrap code here -yii\codeception\TestCase::$applicationConfig = yii\helpers\ArrayHelper::merge( +yii\codeception\TestCase::$appConfig = yii\helpers\ArrayHelper::merge( require(__DIR__ . '/../../config/web.php'), require(__DIR__ . '/../../config/codeception/unit.php') -); \ No newline at end of file +); diff --git a/web/index-test-acceptance.php b/web/index-test-acceptance.php index 224152b..ef9ec75 100644 --- a/web/index-test-acceptance.php +++ b/web/index-test-acceptance.php @@ -1,6 +1,6 @@ run(); +(new yii\web\Application($config))->run(); diff --git a/web/index.php b/web/index.php index e9eeb33..006e28f 100644 --- a/web/index.php +++ b/web/index.php @@ -9,5 +9,4 @@ require(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); -$application = new yii\web\Application($config); -$application->run(); +(new yii\web\Application($config))->run();