test refactoring.

This commit is contained in:
Qiang Xue 2013-12-18 00:40:52 -05:00
parent 0acc59170f
commit 628caf85b9
5 changed files with 8 additions and 12 deletions

View File

@ -25,6 +25,6 @@ class HelloController extends Controller
*/ */
public function actionIndex($message = 'hello world') public function actionIndex($message = 'hello world')
{ {
echo $message."\n"; echo $message . "\n";
} }
} }

View File

@ -39,16 +39,14 @@ $config = [
'params' => $params, 'params' => $params,
]; ];
if (YII_ENV_DEV) if (YII_ENV_DEV) {
{
// configuration adjustments for 'dev' environment // configuration adjustments for 'dev' environment
$config['preload'][] = 'debug'; $config['preload'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module'; $config['modules']['debug'] = 'yii\debug\Module';
$config['modules']['gii'] = 'yii\gii\Module'; $config['modules']['gii'] = 'yii\gii\Module';
} }
if (YII_ENV_TEST) if (YII_ENV_TEST) {
{
// configuration adjustments for 'test' environment. // configuration adjustments for 'test' environment.
// configuration for codeception test environments can be found in codeception folder. // configuration for codeception test environments can be found in codeception folder.

View File

@ -2,7 +2,7 @@
// add unit testing specific bootstrap code here // 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/web.php'),
require(__DIR__ . '/../../config/codeception/unit.php') require(__DIR__ . '/../../config/codeception/unit.php')
); );

View File

@ -1,6 +1,6 @@
<?php <?php
// NOTE: Make sure this file is not accessable when deployed to production // NOTE: Make sure this file is not accessible when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test'); defined('YII_ENV') or define('YII_ENV', 'test');
@ -13,5 +13,4 @@ $config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../config/codeception/acceptance.php') require(__DIR__ . '/../config/codeception/acceptance.php')
); );
$application = new yii\web\Application($config); (new yii\web\Application($config))->run();
$application->run();

View File

@ -9,5 +9,4 @@ require(__DIR__ . '/../vendor/yiisoft/yii2/yii/Yii.php');
$config = require(__DIR__ . '/../config/web.php'); $config = require(__DIR__ . '/../config/web.php');
$application = new yii\web\Application($config); (new yii\web\Application($config))->run();
$application->run();