summaryrefslogtreecommitdiffstats
path: root/tests/mocks/database
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-04-04 14:38:16 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-04-04 14:38:16 +0200
commit44015c8d91ecea78ee4a10de579c36a859c2fcb6 (patch)
tree4081890d25571abb67c49b0b7c7033e226c800be /tests/mocks/database
parent6a96bf7ece4da23e2a802f48c408fa240da776f0 (diff)
Set up PDO constant and configuration
Diffstat (limited to 'tests/mocks/database')
-rw-r--r--tests/mocks/database/config/pdo/mysql.php37
-rw-r--r--tests/mocks/database/config/pdo/pgsql.php37
-rw-r--r--tests/mocks/database/config/pdo/sqlite.php22
-rw-r--r--tests/mocks/database/config/sqlite.php7
4 files changed, 99 insertions, 4 deletions
diff --git a/tests/mocks/database/config/pdo/mysql.php b/tests/mocks/database/config/pdo/mysql.php
new file mode 100644
index 000000000..cefb6b008
--- /dev/null
+++ b/tests/mocks/database/config/pdo/mysql.php
@@ -0,0 +1,37 @@
+<?php
+
+return array(
+
+ // Typical Database configuration
+ 'pdo/mysql' => array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'travis',
+ 'password' => '',
+ 'database' => 'ci_test',
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'mysql',
+ ),
+
+ // Database configuration with failover
+ 'pdo/mysql_failover' => array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'not_travis',
+ 'password' => 'wrong password',
+ 'database' => 'not_ci_test',
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'mysql',
+ 'failover' => array(
+ array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'travis',
+ 'password' => '',
+ 'database' => 'ci_test',
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'mysql',
+ ),
+ ),
+ ),
+); \ No newline at end of file
diff --git a/tests/mocks/database/config/pdo/pgsql.php b/tests/mocks/database/config/pdo/pgsql.php
new file mode 100644
index 000000000..b2f409d8d
--- /dev/null
+++ b/tests/mocks/database/config/pdo/pgsql.php
@@ -0,0 +1,37 @@
+<?php
+
+return array(
+
+ // Typical Database configuration
+ 'pdo/pgsql' => array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'postgres',
+ 'password' => '',
+ 'database' => 'ci_test',
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'pgsql',
+ ),
+
+ // Database configuration with failover
+ 'pdo/pgsql_failover' => array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'not_travis',
+ 'password' => 'wrong password',
+ 'database' => 'not_ci_test',
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'pgsql',
+ 'failover' => array(
+ array(
+ 'dsn' => '',
+ 'hostname' => 'localhost',
+ 'username' => 'postgres',
+ 'password' => '',
+ 'database' => 'ci_test',
+ 'dbdriver' => 'pdo',
+ 'pdodriver' => 'pgsql',
+ ),
+ ),
+ ),
+); \ No newline at end of file
diff --git a/tests/mocks/database/config/pdo/sqlite.php b/tests/mocks/database/config/pdo/sqlite.php
new file mode 100644
index 000000000..c6827b41c
--- /dev/null
+++ b/tests/mocks/database/config/pdo/sqlite.php
@@ -0,0 +1,22 @@
+<?php
+
+return array(
+
+ // Typical Database configuration
+ 'pdo/sqlite' => array(
+ 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/ci_test.sqlite',
+ 'dbdriver' => 'pdo',
+ ),
+
+ // Database configuration with failover
+ 'pdo/sqlite_failover' => array(
+ 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/not_exists.sqlite',
+ 'dbdriver' => 'pdo',
+ 'failover' => array(
+ array(
+ 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/ci_test.sqlite',
+ 'dbdriver' => 'pdo',
+ ),
+ ),
+ ),
+); \ No newline at end of file
diff --git a/tests/mocks/database/config/sqlite.php b/tests/mocks/database/config/sqlite.php
index 8665e208d..c70986e7c 100644
--- a/tests/mocks/database/config/sqlite.php
+++ b/tests/mocks/database/config/sqlite.php
@@ -1,5 +1,4 @@
<?php
-$dbdriver = is_php('5.4') ? 'sqlite3' : 'sqlite';
return array(
@@ -10,7 +9,7 @@ return array(
'username' => 'sqlite',
'password' => 'sqlite',
'database' => realpath(__DIR__.'/..').'/ci_test.sqlite',
- 'dbdriver' => $dbdriver,
+ 'dbdriver' => is_php('5.4') ? 'sqlite3' : 'sqlite',
),
// Database configuration with failover
@@ -20,7 +19,7 @@ return array(
'username' => 'sqlite',
'password' => 'sqlite',
'database' => '../not_exists.sqlite',
- 'dbdriver' => $dbdriver,
+ 'dbdriver' => is_php('5.4') ? 'sqlite3' : 'sqlite',
'failover' => array(
array(
'dsn' => '',
@@ -28,7 +27,7 @@ return array(
'username' => 'sqlite',
'password' => 'sqlite',
'database' => realpath(__DIR__.'/..').'/ci_testf.sqlite',
- 'dbdriver' => $dbdriver,
+ 'dbdriver' => is_php('5.4') ? 'sqlite3' : 'sqlite',
),
),
),