/** * @see MultiDb::amConnectedToDb * * @param string $connector * * @throws ModuleException * @return \Codeception\Lib\Driver\Db */privatefunctiongetDriver($connector)
{
if (!(isset($this->drivers[$connector]) && is_object($this->drivers[$connector]))) {
if (!isset($this->config['connectors'][$connector])) {
thrownewModuleException(
__CLASS__,
"The specified connector, {$connector}, does not exist in the configuration"
);
}
$config = $this->config['connectors'][$connector];
try {
$this->drivers[$connector] = Driver::create($config['dsn'], $config['user'], $config['password']);
$this->executeSqlAgainstDriver(
$this->drivers[$connector]->getDbh(),
"SET time_zone = '{$this->timezone}'" );
} catch (\PDOException$e) {
thrownewModuleException(
__CLASS__,
$e->getMessage() . ' while creating PDO connection ['.get_class($e).']'
);
} catch (\Exception$e) {
thrownewModuleException(
__CLASS__,
$e->getMessage() . ' while creating PDO connection ['.get_class($e).']'
);
}
}
return$this->drivers[$connector];
}
Creating a connection to postgres database fails due to wrong parameter setup.
*** https://github.com/natterbox/Codeception-MultiDb/blame/master/src/Codeception/Extension/MultiDb.php