blob: c04c42b094d1b7ea9b0ade7a9eb5f7ae48b38bc1 [file] [log] [blame]
Taufan Adityaf4c6c9b2012-04-04 23:24:09 +07001<?php
2
3class DB_driver_test extends CI_TestCase {
4
Taufan Adityaf4c6c9b2012-04-04 23:24:09 +07005 public function test_initialize()
6 {
7 $config = Mock_Database_DB::config(DB_DRIVER);
Andrey Andreeve24eed72012-11-02 23:33:45 +02008 sscanf(DB_DRIVER, '%[^/]/', $driver_name);
Taufan Adityaf4c6c9b2012-04-04 23:24:09 +07009 $driver = $this->$driver_name($config[DB_DRIVER]);
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 Andreev79980e42012-11-25 16:32:05 +020024 protected function mysqli($config)
25 {
26 return new Mock_Database_Drivers_Mysqli($config);
27 }
28
Taufan Adityaf4c6c9b2012-04-04 23:24:09 +070029 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 Andreev59d6b4f2012-05-25 02:08:00 +030038
Taufan Adityaf4c6c9b2012-04-04 23:24:09 +070039}