1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-13 14:04:51 +02:00
Files
php-e107/tests/_support/Helper/DelayedDb.php
Deltik eed4b6b10e Reenforced proper module access
\Helper\DelayedDb public methods shouldn't be used as Actor methods
2018-02-19 15:17:31 -06:00

55 lines
962 B
PHP

<?php
namespace Helper;
// here you can define custom actions
// all public methods declared in helper class will be available in $I
class DelayedDb extends \Codeception\Module\Db
{
protected $requiredFields = [];
public function _initialize()
{
// Noop
}
public function _delayedInitialize()
{
return parent::_initialize();
}
public function _getDbHostname()
{
$matches = [];
$matched = preg_match('~host=([^;]+)~s', $this->config['dsn'], $matches);
if (!$matched)
{
return false;
}
return $matches[1];
}
public function _getDbName()
{
$matches = [];
$matched = preg_match('~dbname=([^;]+)~s', $this->config['dsn'], $matches);
if (!$matched)
{
return false;
}
return $matches[1];
}
public function _getDbUsername()
{
return $this->config['user'];
}
public function _getDbPassword()
{
return $this->config['password'];
}
}