summaryrefslogtreecommitdiffstats
path: root/tests/codeigniter/database/DB_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codeigniter/database/DB_test.php')
-rw-r--r--tests/codeigniter/database/DB_test.php45
1 files changed, 24 insertions, 21 deletions
diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php
index c1930f5f2..10e8dec64 100644
--- a/tests/codeigniter/database/DB_test.php
+++ b/tests/codeigniter/database/DB_test.php
@@ -2,11 +2,31 @@
class DB_test extends CI_TestCase {
- public $db_config;
+ // ------------------------------------------------------------------------
- public function set_up()
+ public function test_db_invalid()
{
- $this->db_config = new Mock_Database_DB(array(
+ $db_config = new Mock_Database_DB(array(
+ 'undefined' => array(
+ 'dsn' => '',
+ 'hostname' => 'undefined',
+ 'username' => 'undefined',
+ 'password' => 'undefined',
+ 'database' => 'undefined',
+ 'dbdriver' => 'undefined',
+ ),
+ ));
+
+ $this->setExpectedException('InvalidArgumentException', 'CI Error: Invalid DB driver');
+
+ Mock_Database_DB::DB($db_config->set_dsn('undefined'), TRUE);
+ }
+
+ // ------------------------------------------------------------------------
+
+ public function test_db_valid()
+ {
+ $db_config = new Mock_Database_DB(array(
'mysql' => array(
'dsn' => '',
'hostname' => 'localhost',
@@ -14,30 +34,13 @@ class DB_test extends CI_TestCase {
'password' => '',
'database' => 'ci_test',
'dbdriver' => 'mysql',
- 'dbprefix' => '',
- 'pconnect' => FALSE,
- 'db_debug' => TRUE,
- 'cache_on' => FALSE,
- 'cachedir' => '',
- 'char_set' => 'utf8',
- 'dbcollat' => 'utf8_general_ci',
- 'swap_pre' => '',
- 'autoinit' => TRUE,
- 'stricton' => FALSE,
- 'failover' => array(),
),
));
- }
- // ------------------------------------------------------------------------
-
- public function test_db_valid()
- {
- $db = DB($this->db_config->set_config('mysql'), TRUE);
+ $db = Mock_Database_DB::DB($db_config->set_dsn('mysql'), TRUE);
$this->assertTrue($db instanceof CI_DB);
$this->assertTrue($db instanceof CI_DB_Driver);
- $this->assertTrue($db instanceof CI_DB_active_record);
$this->assertTrue($db instanceof CI_DB_mysql_driver);
}