summaryrefslogtreecommitdiffstats
path: root/tests/mocks/database/db.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-04-26 20:27:02 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-04-26 20:27:02 +0200
commit0713b94f5245c9180b58207b661155f084fb493b (patch)
treee269a5f722e2c129357252ee0e8e649f1588d7e4 /tests/mocks/database/db.php
parent9e2d5d130eff40592b49337a8ba4d8c170934de1 (diff)
parentd115f8327a8f16d957cc4e0876225037bb2f5868 (diff)
Merge pull request #1246 from toopay/db-tests
Improved test coverage for Database.
Diffstat (limited to 'tests/mocks/database/db.php')
-rw-r--r--tests/mocks/database/db.php17
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php
index 43a0d391f..59028ed9c 100644
--- a/tests/mocks/database/db.php
+++ b/tests/mocks/database/db.php
@@ -45,19 +45,18 @@ class Mock_Database_DB {
);
$config = array_merge($this->config[$group], $params);
+ $dsnstring = ( ! empty($config['dsn'])) ? $config['dsn'] : FALSE;
+ $pdodriver = ( ! empty($config['pdodriver'])) ? $config['pdodriver'] : FALSE;
+ $failover = ( ! empty($config['failover'])) ? $config['failover'] : FALSE;
- if ( ! empty($config['dsn']))
- {
- $dsn = $config['dsn'];
- }
- else
- {
- $dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
+ $dsn = $config['dbdriver'].'://'.$config['username'].':'.$config['password']
.'@'.$config['hostname'].'/'.$config['database'];
- }
-
+ // Build the parameter
$other_params = array_slice($config, 6);
+ if ($dsnstring) $other_params['dsn'] = $dsnstring;
+ if ($pdodriver) $other_params['pdodriver'] = $pdodriver;
+ if ($failover) $other_params['failover'] = $failover;
return $dsn.'?'.http_build_query($other_params);
}