Codeception API suite always using main DB instead of test DB

I’m trying to setup API testing in a project with basic template, in order to use a test DB instead of the development/production DB, my file api.suite.yml is configured like this:

actor: ApiTester
     - \Helper\Api
     - REST:
         url: http://localhost/app/api
         depends: PhpBrowser
         part: Json
     - Yii2:
         part: [orm, fixtures]
         transaction: true # don't wrap test in transaction
         cleanup: true # don't cleanup the fixtures
         configFile: 'config/test.php'
     - Db:
         dsn: 'mysql:host=localhost;dbname=db_test'
         user: 'root'
         password: 'Pass'
         dump: 'tests/_data/dump.sql'
         cleanup: true # run populator before each test
         populate: true # run populator before all test
         populator: 'mysql -u $user -h $host $dbname --password=$password < $dump'

and my config/test file is configure like next:

  $db = require __DIR__ . '/test_db.php';
  $params = require __DIR__ . '/params.php';
  $route = require(__DIR__ . '/route.php');

  $config = [
    'id' => 'basic-tests',
    'components' => [
       'db' => $db,
    'modules' => [
    'params' => $params,

return $config;

As you can see, the config/test makes reference to the file test_db.php:

return [
  'class' => 'yii\db\Connection',
  'dsn' =>  'mysql:host=localhost;dbname=db_test',
  'username' => 'root',
  'password' => 'Pass',
  'charset' => 'utf8',

However, when I run the ‘php vendor/bin/codecep run api’, the API tests still using ‘db’ instead of ‘test_db’, my API test file is:

class LoginApiCest
    public function _before(ApiTester $I)

    public function _after(ApiTester $I)

   // tests
   public function tryToUserViaAPITest(\ApiTester $I)
       $I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
       $I->sendPOST('/get-access-token', [
          'username' => 'user',
          'password_hash' => '123456',

Have you any idea of what am I doing wrong? thanks in advance for your valuable help.