added test support

This commit is contained in:
tracer 2022-10-06 16:21:11 +02:00
parent 010914b7bd
commit d2f733d8c2
1 changed files with 95 additions and 92 deletions

View File

@ -30,10 +30,12 @@ class DatabaseConnection
$dbUser = $this->configController->getConfig(configKey: 'dbUser'); $dbUser = $this->configController->getConfig(configKey: 'dbUser');
$dbPassword = $this->configController->getConfig(configKey: 'dbPassword'); $dbPassword = $this->configController->getConfig(configKey: 'dbPassword');
if (!$this->configController->getConfig(configKey: 'test')) {
// TODO create config => encryption key // TODO create config => encryption key
try { try {
$this->dbConnection = new PDO( $this->dbConnection = new PDO(
dsn : "mysql:host=$dbHost;port=$dbPort;charset=utf8mb4;dbname=$dbDatabase", dsn: "mysql:host=$dbHost;port=$dbPort;charset=utf8mb4;dbname=$dbDatabase",
username: $dbUser, username: $dbUser,
password: $dbPassword password: $dbPassword
); );
@ -121,6 +123,7 @@ class DatabaseConnection
exit(1); exit(1);
} }
} }
}
/** /**
@ -136,7 +139,7 @@ class DatabaseConnection
} }
/** /**
* @return \PDO * @return PDO
*/ */
public function getConnection(): PDO public function getConnection(): PDO
{ {