i got some problems with Dbh module in Codeception. First of all, i wanna rollback every db operations in each test (after seeInDatabase of course). So my codeception.yml is
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
After that guide says put this in bootstrap
<?php
\Codeception\Module\Dbh::$dbh = $dbh;
?>
But how can i get $dbh from Db module? At the end i get error
[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
How to setup this correctly?