Identical to original method except but will return a modified version of MySql driver.
public static create ( $dsn, $user, $password ) : Codeception\Lib\Driver\Db | Codeception\Lib\Driver\MsSql | |
||
$dsn | ||
$user | ||
$password | ||
return | Codeception\Lib\Driver\Db | Codeception\Lib\Driver\MsSql | |
/** * Initializes the module. * * @return void */ public function _initialize() { if ($this->config['dump'] && ($this->config['cleanup'] or $this->config['populate'])) { if (!file_exists(Configuration::projectDir() . $this->config['dump'])) { throw new ModuleConfigException(__CLASS__, "\nFile with dump doesn't exist.\n Please, check path for sql file: " . $this->config['dump']); } $sql = file_get_contents(Configuration::projectDir() . $this->config['dump']); $sql = preg_replace('%/\\*(?!!\\d+)(?:(?!\\*/).)*\\*/%s', "", $sql); $this->sql = explode("\n", $sql); } try { $this->driver = Driver::create($this->config['dsn'], $this->config['user'], $this->config['password']); } catch (\PDOException $e) { throw new ModuleConfigException(__CLASS__, $e->getMessage() . ' while creating PDO connection'); } $this->dbh = $this->driver->getDbh(); // starting with loading dump if ($this->config['populate']) { $this->cleanup(); $this->loadDump(); $this->populated = true; } $this->tablePrefix = $this->config['tablePrefix']; }
protected function initialize_driver() { try { $this->driver = Driver::create($this->config['dsn'], $this->config['user'], $this->config['password']); } catch (\PDOException $e) { throw new ModuleConfigException(__CLASS__, $e->getMessage() . ' while creating PDO connection'); } }