Codeception 单元测试 [RuntimeException] 调用未定义的方法 UnitTester::haveRecord

Codeception Unit testing [RuntimeException] Call to undefined method UnitTester::haveRecord

我是 Codeception 的新手,试图在我的 Laravel 框架中 运行 一个示例单元测试,但出现以下错误:

[RuntimeException] Call to undefined method UnitTester::haveRecord

下面的代码我尝试 运行 使用 Codeception:

 <?php namespace Article;
 use App\Article;
 use Faker\Factory as Faker;
 use Carbon\Carbon;
 class SaveTest extends \Codeception\Test\Unit
{
/**
 * @var \UnitTester
 */
protected $tester;

protected function _before()
{
}

protected function _after()
{
}

// tests
public function testSomeFeature()
{
    $faker= Faker::create('App/Article');

        $title = $faker->sentence;
        $content = implode($faker->paragraphs(5));
        $created_at = Carbon::now();
        $updated_at = Carbon::now();


        $this->tester->haveRecord( 'Article',   ['title' => $title, 'content' => $content,'created_at' => $created_at,'updated_at' => $updated_at]);


         $this->tester->seeRecord('articles',['title' => $title,'content' => $content,'created_at' => $created_at,'updated_at' => $updated_at]);




}
}

能帮我解决这个错误吗?提前致谢。

我在 unit.suite.yml

中启用 Laravel5 模块后问题解决了

具有Laravel5模块的unit.suite.yml文件格式:

actor: UnitTester
modules:
 enabled:
    - Asserts
    - Laravel5:
        part: ORM
    - \Helper\Unit