Устанвовка codeception

1. Настройка composer.json

{
    "name": "Tests",
    "description": "BDD-style testing framework",
    "keywords": [
        "BDD",
        "acceptance testing",
        "functional testing",
        "unit testing",
        "tdd"
    ],
    "homepage": "http://codeception.com/",
    "type": "library",
    "license": "MIT",
    "authors": [
        {
            "name": "Michael Bodnarchuk",
            "email": "davert@mail.ua",
            "homepage": "http://codegyre.com"
        }
    ],
    "minimum-stability": "RC",
    "require": {
        "php": ">=5.6.0 <8.0",
        "codeception/codeception": "^4.0",
        "codeception/module-webdriver": "^1.0"
    },
    "require-dev": {
        "codeception/util-robohelpers": "dev-master",
        "codeception/module-rest": "^1.0",
        "codeception/module-phpbrowser": "^1.0",
        "codeception/module-asserts": "^1.2"
    }
}
composer install

2. кооманда на формитрование папки с настроками codeception:

 cd api
 php vendor/bin/codecept bootstrap --namespace api 

такая структура должна получиться:

3.Настройка api/tests/unit/_bootstrap.php:

<?php
// Here you can initialize variables that will be available to your tests
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
 
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../../common/config/bootstrap.php';
require __DIR__ . '/../../config/bootstrap.php';
 
$config = require __DIR__ . '/../../config/codeception-local.php';
 
$app = new yii\console\Application($config);

4. Создаем файлик настроек приложения api/config/codeception-local.php настройки скопировал из main.php, кроме

 'errorHandler' => [
            'errorAction' => 'site/error',
        ],) 

настройка тестовой базы:
добавил в api/config/codeception-local.php:

   'db' => [
            'class' => 'yii\db\Connection',
            'dsn' => 'mysql:host=db;dbname=tests',
            'username' => 'root',
            'password' => '2619192',
            'charset' => 'utf8',
        ],

запуск тестов, комманда /var/www/advanced/api# ../vendor/bin/codecept run

Api.unit Tests (22) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
✔ ModelsBehaviorTest: Before delete | #0 (0.03s)
✔ ModelsBehaviorTest: Before delete | #1 (0.02s)
✔ ModelsBehaviorTest: Before delete | #2 (0.02s)
✖ ModelsBehaviorTest: Before delete | #3 (0.02s)
✔ ModelsBehaviorTest: Before delete | #4 (0.02s)
✔ ModelsBehaviorTest: Before delete | #5 (0.02s)
✔ ModelsBehaviorTest: Before delete | #6 (0.06s)
✔ ModelsBehaviorTest: Before delete | #7 (0.02s)
✖ ModelsBehaviorTest: Before delete | #8 (0.02s)
✔ ModelsBehaviorTest: Before delete | #9 (0.14s)
✔ ModelsBehaviorTest: After soft delete (0.00s)
✔ ModelsBehaviorTest: Events (0.00s)
✔ ModelsBehaviorTest: Before soft delete (0.00s)
✔ CommentTest: Get comments | #0 (0.06s)
✔ CommentTest: Get comments | #1 (0.04s)
✔ CommentTest: Get comments | #2 (0.03s)
✔ CommentTest: Get comments | #3 (0.03s)
✔ CommentTest: Get comments | #4 (0.03s)
✔ CommentTest: Get comments | #5 (0.03s)
✔ CommentTest: Send new comment (0.00s)
✔ CommentTest: Set comment (0.00s)
✔ CommentTest: Behaviors (0.00s)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2x DEPRECATION: Calling the "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()" method with the event name as the first argument is deprecated since Symfony 4.3, pass it as the second argument and provide the event object as the first argument instead. /var/www/advanced/vendor/symfony/event-dispatcher/EventDispatcher.php:58
 
Time: 800 ms, Memory: 92.49 MB
 
There were 2 failures:
 
---------
1) ModelsBehaviorTest: Before delete | #3
 Test  tests/unit/components/ModelsBehaviorTest.php:testBeforeDelete
В классе \modules\dir\models\CurrencyCourses не найдено поле isdeleted, проверка методом canGetProperty
Failed asserting that false is true.
#1  /var/www/advanced/api/tests/unit/components/ModelsBehaviorTest.php:31

---------
2) ModelsBehaviorTest: Before delete | #8
 Test  tests/unit/components/ModelsBehaviorTest.php:testBeforeDelete
В классе \modules\promo\models\basePromotionTag не найдено поле isdeleted, проверка методом canGetProperty
Failed asserting that false is true.
#1  /var/www/advanced/api/tests/unit/components/ModelsBehaviorTest.php:31

FAILURES!