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
如何正確設置?