diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-04-02 10:14:04 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-04-02 10:14:04 +0200 |
commit | a9572fa67e4778f7d0a42898c603fddcb64660f8 (patch) | |
tree | 48a7785021377dd3e7f8fcd3ff41f3cf650c327b /tests/codeigniter/database | |
parent | 2efd029d012fedd421540d14b8a5759032c0b5c6 (diff) | |
parent | d3891f4f50e3cb3cfd1b6491088d759d586e2302 (diff) |
Merge upstream branch
Diffstat (limited to 'tests/codeigniter/database')
-rw-r--r-- | tests/codeigniter/database/DB_test.php | 49 | ||||
-rw-r--r-- | tests/codeigniter/database/query_builder/.gitkeep (renamed from tests/codeigniter/database/.gitkeep) | 0 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/codeigniter/database/DB_test.php b/tests/codeigniter/database/DB_test.php new file mode 100644 index 000000000..9b93e223d --- /dev/null +++ b/tests/codeigniter/database/DB_test.php @@ -0,0 +1,49 @@ +<?php + +class DB_test extends CI_TestCase { + + // ------------------------------------------------------------------------ + + public function test_db_invalid() + { + $connection = 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($connection->set_dsn('undefined'), TRUE); + } + + // ------------------------------------------------------------------------ + + public function test_db_valid() + { + $config = Mock_Database_DB::config(DB_DRIVER); + $connection = new Mock_Database_DB($config); + $db = Mock_Database_DB::DB($connection->set_dsn(DB_DRIVER), TRUE); + + $this->assertTrue($db instanceof CI_DB); + $this->assertTrue($db instanceof CI_DB_Driver); + } + + // ------------------------------------------------------------------------ + + public function test_db_failover() + { + $config = Mock_Database_DB::config(DB_DRIVER); + $connection = new Mock_Database_DB($config); + $db = Mock_Database_DB::DB($connection->set_dsn(DB_DRIVER.'_failover'), TRUE); + + $this->assertTrue($db instanceof CI_DB); + $this->assertTrue($db instanceof CI_DB_Driver); + } + +}
\ No newline at end of file diff --git a/tests/codeigniter/database/.gitkeep b/tests/codeigniter/database/query_builder/.gitkeep index e69de29bb..e69de29bb 100644 --- a/tests/codeigniter/database/.gitkeep +++ b/tests/codeigniter/database/query_builder/.gitkeep |