Taufan Aditya | f4c6c9b | 2012-04-04 23:24:09 +0700 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | class DB_driver_test extends CI_TestCase { |
| 4 | |
Taufan Aditya | f4c6c9b | 2012-04-04 23:24:09 +0700 | [diff] [blame] | 5 | public function test_initialize() |
| 6 | { |
| 7 | $config = Mock_Database_DB::config(DB_DRIVER); |
Andrey Andreev | e24eed7 | 2012-11-02 23:33:45 +0200 | [diff] [blame] | 8 | sscanf(DB_DRIVER, '%[^/]/', $driver_name); |
Andrey Andreev | b5925ec | 2015-02-26 10:06:54 +0200 | [diff] [blame^] | 9 | $driver = $this->{$driver_name}($config[DB_DRIVER]); |
Taufan Aditya | f4c6c9b | 2012-04-04 23:24:09 +0700 | [diff] [blame] | 10 | |
| 11 | $this->assertTrue($driver->initialize()); |
| 12 | } |
| 13 | |
| 14 | protected function pdo($config) |
| 15 | { |
| 16 | return new Mock_Database_Drivers_PDO($config); |
| 17 | } |
| 18 | |
| 19 | protected function mysql($config) |
| 20 | { |
| 21 | return new Mock_Database_Drivers_Mysql($config); |
| 22 | } |
| 23 | |
Andrey Andreev | 79980e4 | 2012-11-25 16:32:05 +0200 | [diff] [blame] | 24 | protected function mysqli($config) |
| 25 | { |
| 26 | return new Mock_Database_Drivers_Mysqli($config); |
| 27 | } |
| 28 | |
Taufan Aditya | f4c6c9b | 2012-04-04 23:24:09 +0700 | [diff] [blame] | 29 | protected function sqlite($config) |
| 30 | { |
| 31 | return new Mock_Database_Drivers_Sqlite($config); |
| 32 | } |
| 33 | |
| 34 | protected function pgsql($config) |
| 35 | { |
| 36 | return new Mock_Database_Drivers_Postgre($config); |
| 37 | } |
Andrey Andreev | 59d6b4f | 2012-05-25 02:08:00 +0300 | [diff] [blame] | 38 | |
Taufan Aditya | f4c6c9b | 2012-04-04 23:24:09 +0700 | [diff] [blame] | 39 | } |