Codeception fixture without instantiate db component?

I have fixture which job is all about the filesystem, nothing with any database. It works fine when is loaded from command line.
However, when I hook it up to the codeception test it generates error

[yii\di\NotInstantiableException] Failed to instantiate component or class "db"

In fact I have no db in my project.
How can I run codeception test with fixture without db component instantiate try?

You need to provide sample of what is not working.
https://forum.yiiframework.com/t/how-to-ask-a-question-that-will-land-you-a-help/133752/2

You need to provide sample of what is not working.

I have thought it would be something pretty easy :slight_smile: Few details then:
In my unit test class I added method to run fixture which job is prepare some files:

class VersionTrimTestTest extends \Codeception\Test\Unit
[...]
public function _fixtures()
  {
    return [
      'files' => VersionedFilesFixture::class,
    ];
  }

When running, every test method throws exception e.g:

1) VersionTrimTestTest: Function get older files keep files
 Test  tests/unit/VersionTrimTestTest.php:testFunctionGetOlderFilesKeepFiles

[yii\di\NotInstantiableException] Failed to instantiate component or class "db".

#1  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:509
#2  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:507
#3  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:385
#4  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:170
#5  /opt/backtest-dev/vendor/yiisoft/yii2/di/Instance.php:176
#6  /opt/backtest-dev/vendor/yiisoft/yii2/di/Instance.php:145
#7  /opt/backtest-dev/vendor/yiisoft/yii2/test/DbFixture.php:41
#8  /opt/backtest-dev/vendor/yiisoft/yii2/base/BaseObject.php:109
#9  yii\base\BaseObject->__construct
#10 /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:411
#1  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:507
#2  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:385
#3  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:170
#4  /opt/backtest-dev/vendor/yiisoft/yii2/di/Instance.php:176
#5  /opt/backtest-dev/vendor/yiisoft/yii2/di/Instance.php:145
#6  /opt/backtest-dev/vendor/yiisoft/yii2/test/DbFixture.php:41
#7  /opt/backtest-dev/vendor/yiisoft/yii2/base/BaseObject.php:109
#8  yii\base\BaseObject->__construct
#9  /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:411
#10 /opt/backtest-dev/vendor/yiisoft/yii2/di/Container.php:170

Manually the fixture works fine, I can run it from command line without any problems. In my project I have no db component. I don’t want the codeception tries to instantiate any. Is this possible?

Hi, I have similar problem.

There are 2 databases in my app, so in the config file (common\config\test-local.php) there are 2 components (class yii\db\Connection), respectively with id “db1” and “db2” , but no one with id “db”.

When I run codeception test it generates error:
[yii\di\NotInstantiableException] Failed to instantiate component or class “db”.

However I overrided the “db” property of my Fixture:

class MyFixture extends ActiveFixture
{
    public $modelClass = '\path\to\MyARModel';
    public $db = 'db1';
}

If I create an empty database, then add it as “db” component to config file, all works well (although tests run on db1).

How can I run codeception test with fixture without db component instantiate try?