added options for testing

This commit is contained in:
tracer 2022-10-08 10:55:25 +02:00
parent 91ea53275e
commit 2965e9b7ce
1 changed files with 20 additions and 19 deletions

View File

@ -2,7 +2,7 @@
namespace App\Controller; namespace App\Controller;
error_reporting(error_level: E_ALL); //error_reporting(error_level: E_ALL);
use PDO; use PDO;
@ -30,16 +30,17 @@ 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
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
); );
if (!$this->configController->getConfig(configKey: 'test')) {
// TODO create config => encryption key
try {
$sql = "SHOW TABLES"; $sql = "SHOW TABLES";
$statement = $this->dbConnection->prepare(query: $sql); $statement = $this->dbConnection->prepare(query: $sql);
$statement->execute(); $statement->execute();
$result = $statement->fetch(); $result = $statement->fetch();