blob: 1f48ca984d9c7a9d2ba4b36af66c767930d4e757 [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
24 protected function sqlite($config)
25 {
26 return new Mock_Database_Drivers_Sqlite($config);
27 }
28
29 protected function pgsql($config)
30 {
31 return new Mock_Database_Drivers_Postgre($config);
32 }
Andrey Andreev59d6b4f2012-05-25 02:08:00 +030033
Taufan Adityaf4c6c9b2012-04-04 23:24:09 +070034}