【发布时间】:2015-01-16 21:28:18
【问题描述】:
我正在尝试通过单元测试构建 Yii2 应用程序,对此我有一些疑问。
class UsersTest extends \Codeception\TestCase\Test
{
/**
* @var \UnitTester
*/
protected $users;
protected function _before()
{
$this->users = new \app\models\Users;
}
protected function _after()
{
}
// tests
public function testGeId()
{
}
}
当我尝试运行这个测试类时,我收到了找不到用户类的致命错误消息。问题的原因是什么以及如何解决?
Yii2 测试文件夹中有自述文件,告诉我们设置 yii2-faker 和 yii2_basic_tests 数据库。这两个东西是什么,为什么要使用它们?
谢谢。
【问题讨论】:
标签: unit-testing phpunit yii2 codeception