使用Codeception设置进行Yii2 /高级应用程序单元测试

I have a Yii2 site with Yii2 Advanced Project Template. U have to test the application.

My unit tests works unlett I try to test something that uses database.

The response I got is this:

1) models\XmlTest::testRootError yii\base\InvalidConfigException: Unknown component ID: db

I had created the test database and the tables. I have the same db/app with Simple project template and my tests works fine but when I want to use those in my advanced template, i got those errors.

I hade googled, search solutions in google and here also, but didn't found anything.

Can you please suggest me something about this?

Directory structure:
backend/
common/
console/
environments/
frontend/
tests/
tests/codeception/
tests/codeception/_output/
tests/codeception/backend/
tests/codeception/bin/
tests/codeception/common/
tests/codeception/config/
tests/codeception/console/
tests/codeception/frontend/
vendor/

/tests/codeception/config/config.php:

<?php
/**
 * Application configuration for all backend test types
 */
return [
'components' => [
    'db' => [
        'dsn' => 'mysql:host=localhost;dbname=app_test',
    ],
    'mailer' => [
        'useFileTransport' => true,
    ],
    'urlManager' => [
        'showScriptName' => true,
    ],
],
];