我在yii2中的项目的代码接收中的数据库配置有问题。每次我执行codecept运行时。发生错误[yii \ db \ Exception] SQLSTATE [HY000] [1049]未知数据库yii2advanced_test,它是common / config / main-local上的数据库配置是“ mydb”。我用谷歌搜索解决方案并应用了它,但是没有任何效果。我使用yii2-user,试图找出数据库配置在哪里使用yii2_advanced_tests,但是它不存在
这是我的main-local.php
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=mydb',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
],
];
,我试图将这段代码添加到functional.suite.yml
suite_namespace: frontend\tests\functional
actor: FunctionalTester
modules:
enabled:
- Filesystem
- Yii2
- Db
config:
Db:
dsn: 'mysql:host=localhost;dbname=mydb'
user: 'root'
password: ''
dump: tests/_data/dump.sql
仍然没有任何效果。请帮助我