Laravel 4 codeception laravel迁移采用凭证形式app/testing/database.php,而不是codeception.yml
我注意到codeception中有一个strage行为: 如果我仅依赖codeception.yml,则:Laravel 4 codeception laravel迁移采用凭证形式app/testing/database.php,而不是codeception.yml,laravel-4,phpunit,codeception,Laravel 4,Phpunit,Codeception,我注意到codeception中有一个strage行为: 如果我仅依赖codeception.yml,则: actor: Tester paths: tests: tests log: tests/_output data: tests/_data helpers: tests/_support settings: bootstrap: _bootstrap.php colors: true memory_limit: 1024M modu
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
config:
Db:
dsn: 'mysql:host=localhost;dbname=test'
user: 'test'
password: 'test'
dump: tests/_data/dump.sql
运行:
php artisan migrate--package=cartalyst/sentry--env=“testing”php
artisan迁移--种子--env=“测试”
我犯了这个错误
[PDO例外]SQLSTATE[42000][1044]拒绝用户“”@'localhost'访问 数据库“forge” 如果我将database.php文件放在app/config/testing中 与 没关系
我是codeception的新手,所以我想知道是怎么回事,如果我做错了什么。所以数据库访问有两个方面:
tests/\u data/dump.sql
文件“刷新”数据库
Codeception在实际测试期间(就在测试之前/之后)不使用“直接”数据库访问。运行迁移时,您正在将环境设置为“测试”,因此需要相应的数据库配置进行测试。您似乎已经回答了自己的问题?我已经阅读了《laravel testing decoded》一书,书中指出要填充测试数据库,您应该运行php artisan migrate--seed--env=“testing”,但我等待对codeception.yml的调用,而不是对database.phpThanks的调用,以获得回复。因此,您说的是等待行为,是吗?是的,这是正确的行为,以及codeception和过程是如何工作的
return array(
'default' => 'mysql',
'connections' => array(
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'lama-test',
'username' => 'lama-test',
'password' => 'lama-test',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
)
),