[英]Implementing Codeception with Yii1
我正在嘗試對在Yii1中完成的項目進行單元測試。 這些是我采取的步驟
添加了composer.json並添加了以下內容
{
"require-dev": {
"codeception/codeception": "2.3.*",
"codeception/yii-bridge":"dev-master"
}
}
並通過引導創建了整套西裝
在我的unit.suit.yml中,我添加了
- Yii1:
appPath: '../index-test.php'
url: 'http://localhost/pricingdb/index-test.php/'
在我的index-test.php中
<?php
defined('DS') or define('DS', DIRECTORY_SEPARATOR);
$yii=dirname(__FILE__).'/../../yii-1.1.12.b600af/framework/yii.php';
$config=dirname(__FILE__).'/protected/config/test.php';
defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once($yii);
require_once __DIR__.DS.'vendor'.DS.'autoload.php';
return array(
'class' => 'CWebApplication',
'config' => $config,
);
在我的config / test.php中
<?php
return CMap::mergeArray(
require(dirname(__FILE__) . '/main.php'), array(
'components' => array(
'request' => array(
'class' => 'CodeceptionHttpRequest'
),
),
)
);
當我嘗試使用以下命令從受保護的文件夾運行單元測試時
..\vendor\bin\codecept run unit
我收到以下消息
In Yii1.php line 173:
Yii1 module is not configured!
Codeception-Yii Bridge is not launched. In order to run tests you need to install https://github.com/Codeception/Yi
iBridge Implement function 'launch_codeception_yii_bridge' to load all Codeception overrides
我在這里想念什么? “執行功能'launch_codeception_yii_bridge'加載所有Codeception覆蓋”是什么意思? 我怎么做?
我加了
require_once __DIR__.'/../../../../vendor/codeception/yii-bridge/yiit.php';
在Helper / Unit.php中,它現在似乎可以工作了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.