aboutsummaryrefslogtreecommitdiffstats
path: root/tests/dbal
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2012-12-08 03:04:05 +0100
committerAndreas Fischer <bantu@phpbb.com>2012-12-08 03:04:05 +0100
commitb5f94a14f1a5c77366f824780f1120a1b5e9184a (patch)
tree22c4c57a1fc7a3d2e0f2946272c3c0725f125446 /tests/dbal
parenta8deb7f87b359802f9a8a53e44f4f9a9a6d87575 (diff)
parent5120f36a258ffcbffd5c10e9a1056d64ea794a16 (diff)
downloadforums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar
forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar.gz
forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar.bz2
forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.tar.xz
forums-b5f94a14f1a5c77366f824780f1120a1b5e9184a.zip
Merge remote-tracking branch 'p/ticket/10205' into develop-olympus
* p/ticket/10205: [ticket/10205] Reduce nesting in mysql drivers. [ticket/10205] Rewrite _sql_error implementations to have a single return. [ticket/10205] Cosmetic changes. [ticket/10205] Add some columns to the empty fixture file for mssqlnative. [ticket/10205] Delete stray return. [ticket/10205] Test failed connection attempts. [ticket/10205] Check for function existence in mssql connect method. [ticket/10205] Convert mssqlnative driver to the same logic. [ticket/10205] Fix a parse error in oracle driver. [ticket/10205] Fix remaining db drivers. [ticket/10205] Avoid calling mysqli functions when mysqli is missing. [ticket/10205] Account for potentially missing extensions in dbal.
Diffstat (limited to 'tests/dbal')
-rw-r--r--tests/dbal/connect_test.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/dbal/connect_test.php b/tests/dbal/connect_test.php
new file mode 100644
index 0000000000..505ce28fa1
--- /dev/null
+++ b/tests/dbal/connect_test.php
@@ -0,0 +1,43 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+
+class phpbb_dbal_connect_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/../fixtures/empty.xml');
+ }
+
+ public function test_failing_connect()
+ {
+ global $phpbb_root_path, $phpEx;
+
+ $config = $this->get_database_config();
+
+ require_once dirname(__FILE__) . '/../../phpBB/includes/db/' . $config['dbms'] . '.php';
+ $dbal = 'dbal_' . $config['dbms'];
+ $db = new $dbal();
+
+ // Failure to connect results in a trigger_error call in dbal.
+ // phpunit converts triggered errors to exceptions.
+ // In particular there should be no fatals here.
+ try
+ {
+ $db->sql_connect($config['dbhost'], 'phpbbogus', 'phpbbogus', 'phpbbogus', $config['dbport']);
+ $this->assertFalse(true);
+ }
+ catch (Exception $e)
+ {
+ // should have a legitimate message
+ $this->assertNotEmpty($e->getMessage());
+ }
+ }
+}