summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/mocks/database/config/ci_test.sqlite0
-rw-r--r--tests/mocks/database/config/pdo/sqlite.php20
-rw-r--r--tests/mocks/database/db.php13
3 files changed, 19 insertions, 14 deletions
diff --git a/tests/mocks/database/config/ci_test.sqlite b/tests/mocks/database/config/ci_test.sqlite
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/mocks/database/config/ci_test.sqlite
+++ /dev/null
diff --git a/tests/mocks/database/config/pdo/sqlite.php b/tests/mocks/database/config/pdo/sqlite.php
index 1e5043b00..c68b4b213 100644
--- a/tests/mocks/database/config/pdo/sqlite.php
+++ b/tests/mocks/database/config/pdo/sqlite.php
@@ -4,20 +4,32 @@ return array(
// Typical Database configuration
'pdo/sqlite' => array(
- 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/ci_test.sqlite',
+ 'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
+ 'hostname' => 'localhost',
+ 'username' => 'sqlite',
+ 'password' => 'sqlite',
+ 'database' => 'sqlite',
'dbdriver' => 'pdo',
'pdodriver' => 'sqlite',
),
// Database configuration with failover
'pdo/sqlite_failover' => array(
- 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/not_exists.sqlite',
+ 'dsn' => 'sqlite:not_exists.sqlite',
+ 'hostname' => 'localhost',
+ 'username' => 'sqlite',
+ 'password' => 'sqlite',
+ 'database' => 'sqlite',
'dbdriver' => 'pdo',
'pdodriver' => 'sqlite',
'failover' => array(
array(
- 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/ci_test.sqlite',
- 'dbdriver' => 'pdo',
+ 'dsn' => 'sqlite:/'.realpath(__DIR__.'/../..').'/ci_test.sqlite',
+ 'hostname' => 'localhost',
+ 'username' => 'sqlite',
+ 'password' => 'sqlite',
+ 'database' => 'sqlite',
+ 'dbdriver' => 'pdo',
'pdodriver' => 'sqlite',
),
),
diff --git a/tests/mocks/database/db.php b/tests/mocks/database/db.php
index c30e6d2e6..59028ed9c 100644
--- a/tests/mocks/database/db.php
+++ b/tests/mocks/database/db.php
@@ -45,23 +45,16 @@ 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);
- $other_params['dsn'] = $dsn;
+ if ($dsnstring) $other_params['dsn'] = $dsnstring;
if ($pdodriver) $other_params['pdodriver'] = $pdodriver;
if ($failover) $other_params['failover'] = $failover;