Taufan Aditya | f4c6c9b | 2012-04-04 23:24:09 +0700 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | class DB_driver_test extends CI_TestCase { |
| 4 | |
| 5 | // ------------------------------------------------------------------------ |
| 6 | |
| 7 | public function test_initialize() |
| 8 | { |
| 9 | $config = Mock_Database_DB::config(DB_DRIVER); |
| 10 | $driver_name = current(explode('/', DB_DRIVER)); |
| 11 | $driver = $this->$driver_name($config[DB_DRIVER]); |
| 12 | |
| 13 | $this->assertTrue($driver->initialize()); |
| 14 | } |
| 15 | |
| 16 | protected function pdo($config) |
| 17 | { |
| 18 | return new Mock_Database_Drivers_PDO($config); |
| 19 | } |
| 20 | |
| 21 | protected function mysql($config) |
| 22 | { |
| 23 | return new Mock_Database_Drivers_Mysql($config); |
| 24 | } |
| 25 | |
| 26 | protected function sqlite($config) |
| 27 | { |
| 28 | return new Mock_Database_Drivers_Sqlite($config); |
| 29 | } |
| 30 | |
| 31 | protected function pgsql($config) |
| 32 | { |
| 33 | return new Mock_Database_Drivers_Postgre($config); |
| 34 | } |
| 35 | |
| 36 | } |