0
我在Codeception中遇到了Dbh模块的一些问题。 首先,我想回滚每个测试中的每个数据库操作(在看到数据库之后)。所以我codeception.yml是Codeception,Dbh,transactions
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
memory_limit: 1024M
log: true
colors: true
coverage:
enabled: true
remote: true
include:
- controllers/*
- models/*
- widgets/*
modules:
enabled: [Db,Dbh]
config:
Db:
dsn: 'mysql:host=localhost;dbname=baxi'
user: 'root'
password: ''
#dump: tests/_data/dump.sql
cleanup: true
Dbh:
cleanup: false
该指南说把这个引导
<?php
\Codeception\Module\Dbh::$dbh = $dbh;
?>
但我怎样才能从DB模块$胸径之后?最后我得到错误
[Codeception\Exception\ModuleConfig]
Dbh module is not configured!
Transaction module requires PDO instance explicitly set.
You can use your bootstrap file to assign the dbh:
\Codeception\Module\Dbh::$dbh = $dbh
如何正确设置?