Yii2 调用未定义的函数测试\codeception\unit\models\expect()

Yii2 调用未定义的函数测试\codeception\unit\models\expect(),yii2,phpunit,codeception,Yii2,Phpunit,Codeception,我试图在Yi2基本应用程序中使用默认的ContactFormTest执行单元测试。但它给了我以下错误 E:\xampp\htdocs\news\tests>codecept run unit codeception\unit\models\ContactForm Test.php Codeception PHP Testing Framework v2.0.16 Powered by PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

我试图在Yi2基本应用程序中使用默认的ContactFormTest执行单元测试。但它给了我以下错误

E:\xampp\htdocs\news\tests>codecept run unit codeception\unit\models\ContactForm
Test.php
Codeception PHP Testing Framework v2.0.16
Powered by PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

←[1mUnit Tests (1) ←[22m--------------------------------------------------------
------------------------------------
←[35;1mTest contact←[39;22m (tests\codeception\unit\models\ContactFormTest::test
Contact)<pre>PHP Fatal Error &#039;yii\base\ErrorException&#039; with message &#
039;Call to undefined function tests\codeception\unit\models\expect()&#039;

in E:\xampp\htdocs\news\tests\codeception\unit\models\ContactFormTest.php:46

Stack trace:
#0 [internal function]: yii\base\ErrorHandler-&gt;handleFatalError()
#1 {main}</pre>
和unit.suite.yml

"require-dev": {
    ...
    "codeception/specify": "*",
    "codeception/verify": "*"
}

如何解决此问题?

您的IDE是否识别
指定中的
expect
函数调用

如果没有,请尝试按照手册中的规定,将和添加到
要求开发人员
编写器依赖项:

然后运行
composer update

俄语读者请注意

# Codeception Test Suite Configuration

# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.

class_name: UnitTester
modules:
    config:
        Db:
            dsn: 'mysql:host=127.0.0.1;dbname=news_tests'
            user: 'root'
            password: ''
            dump: 'tests/_data/dump.sql'
            populate: false
            cleanup: false
            reconnect: true
"require-dev": {
    ...
    "codeception/specify": "*",
    "codeception/verify": "*"
}