From 44015c8d91ecea78ee4a10de579c36a859c2fcb6 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 4 Apr 2012 19:38:16 +0700 Subject: Set up PDO constant and configuration --- tests/mocks/database/config/pdo/mysql.php | 37 ++++++++++++++++++++++++++++++ tests/mocks/database/config/pdo/pgsql.php | 37 ++++++++++++++++++++++++++++++ tests/mocks/database/config/pdo/sqlite.php | 22 ++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 tests/mocks/database/config/pdo/mysql.php create mode 100644 tests/mocks/database/config/pdo/pgsql.php create mode 100644 tests/mocks/database/config/pdo/sqlite.php (limited to 'tests/mocks/database/config/pdo') 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 @@ + 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 @@ + 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 @@ + 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 -- cgit v1.2.3-24-g4f1b From f4c6c9b3061b464c959b6409f962228959f35287 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 4 Apr 2012 23:24:09 +0700 Subject: DB Drivers test --- tests/mocks/database/config/pdo/sqlite.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/mocks/database/config/pdo') diff --git a/tests/mocks/database/config/pdo/sqlite.php b/tests/mocks/database/config/pdo/sqlite.php index c6827b41c..1e5043b00 100644 --- a/tests/mocks/database/config/pdo/sqlite.php +++ b/tests/mocks/database/config/pdo/sqlite.php @@ -6,16 +6,19 @@ return array( 'pdo/sqlite' => array( 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/ci_test.sqlite', 'dbdriver' => 'pdo', + 'pdodriver' => 'sqlite', ), // Database configuration with failover 'pdo/sqlite_failover' => array( 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/not_exists.sqlite', 'dbdriver' => 'pdo', + 'pdodriver' => 'sqlite', 'failover' => array( array( 'dsn' => 'sqlite:/'.realpath(__DIR__.'/..').'/ci_test.sqlite', 'dbdriver' => 'pdo', + 'pdodriver' => 'sqlite', ), ), ), -- cgit v1.2.3-24-g4f1b From 197251479b6c55d7fd65ef8f0eccc14450b1cbec Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 4 Apr 2012 23:46:23 +0700 Subject: Fix sqlite issue on PHP 5.4 both for native and PDO driver --- tests/mocks/database/config/pdo/sqlite.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/mocks/database/config/pdo') 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', ), ), -- cgit v1.2.3-24-g4f1b From 55f804239cb0141fdac748607d8cdfa143efac92 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Thu, 5 Apr 2012 01:48:52 +0700 Subject: Add dsn to pgsql --- tests/mocks/database/config/pdo/pgsql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/mocks/database/config/pdo') diff --git a/tests/mocks/database/config/pdo/pgsql.php b/tests/mocks/database/config/pdo/pgsql.php index b2f409d8d..5196e9ad9 100644 --- a/tests/mocks/database/config/pdo/pgsql.php +++ b/tests/mocks/database/config/pdo/pgsql.php @@ -4,7 +4,7 @@ return array( // Typical Database configuration 'pdo/pgsql' => array( - 'dsn' => '', + 'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;', 'hostname' => 'localhost', 'username' => 'postgres', 'password' => '', @@ -24,7 +24,7 @@ return array( 'pdodriver' => 'pgsql', 'failover' => array( array( - 'dsn' => '', + 'dsn' => 'pgsql:host=localhost;port=5432;dbname=ci_test;', 'hostname' => 'localhost', 'username' => 'postgres', 'password' => '', -- cgit v1.2.3-24-g4f1b