diff options
author | Igor Wiedler <igor@wiedler.ch> | 2011-02-14 09:15:51 +0100 |
---|---|---|
committer | Igor Wiedler <igor@wiedler.ch> | 2011-02-14 14:48:42 +0100 |
commit | 17b17bc9399c0e72bebb74979f42aae5a683ae8b (patch) | |
tree | f4e2b6160e3609aec798d065e32969e54e1c99df /tests/test_framework | |
parent | 6c7f49f56199a5e4de195731c2d7a8aacd33dd53 (diff) | |
download | forums-17b17bc9399c0e72bebb74979f42aae5a683ae8b.tar forums-17b17bc9399c0e72bebb74979f42aae5a683ae8b.tar.gz forums-17b17bc9399c0e72bebb74979f42aae5a683ae8b.tar.bz2 forums-17b17bc9399c0e72bebb74979f42aae5a683ae8b.tar.xz forums-17b17bc9399c0e72bebb74979f42aae5a683ae8b.zip |
[task/refactor-db-testcase] Improve error message of db tests
If database tests cannot be run the error message is ambigous. This
commit makes it clearer:
- whether the supplied dbms is supported by us
- which dbms are supported by us
- whether the required PDO extension is loaded
PHPBB3-10043
Diffstat (limited to 'tests/test_framework')
-rw-r--r-- | tests/test_framework/phpbb_database_test_connection_manager.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index e4b306f13f..3389081c4e 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -76,7 +76,14 @@ class phpbb_database_test_connection_manager break; } - $this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']);; + try + { + $this->pdo = new PDO($dsn, $this->config['dbuser'], $this->config['dbpasswd']); + } + catch (PDOException $e) + { + throw new Exception("Unable do connect to $dsn with error: {$e->getMessage()}"); + } // good for debug // $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -330,7 +337,9 @@ class phpbb_database_test_connection_manager } else { - trigger_error('Database unsupported', E_USER_ERROR); + $message = 'Supplied dbms is unsupported, must be one of: '; + $message .= implode(', ', array_keys($available_dbms)); + throw new Exception($message); } } } |