From 496657aa5d0088d9c769cf9e6cdb18ac0f4b7add Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sat, 16 Feb 2019 19:21:46 +0000 Subject: [PATCH] echo something helpful on db error when testing --- functions.inc.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/functions.inc.php b/functions.inc.php index 9156cfa4..560be291 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -1561,6 +1561,9 @@ function db_connect_with_errors() { } } } catch (PDOException $e) { + if (defined('PHPUNIT_TEST')) { + echo json_encode(['dsn' => $dsn, 'db_user' => Config::read_string('database_user'), 'db_pass' => Config::read_string('database_password'), 'options' => $options, 'exception_message' => $e->getMessage()], JSON_PRETTY_PRINT); + } $error_text = 'PDO exception: '. $e->getMessage(); }