diff options
author | Taufan Aditya <toopay@taufanaditya.com> | 2012-04-04 18:24:09 +0200 |
---|---|---|
committer | Taufan Aditya <toopay@taufanaditya.com> | 2012-04-04 18:24:09 +0200 |
commit | f4c6c9b3061b464c959b6409f962228959f35287 (patch) | |
tree | 2e277194428bdbeb5a515817bbc35ad3bb6dc95f /tests/mocks/autoloader.php | |
parent | 44015c8d91ecea78ee4a10de579c36a859c2fcb6 (diff) |
DB Drivers test
Diffstat (limited to 'tests/mocks/autoloader.php')
-rw-r--r-- | tests/mocks/autoloader.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php index dd5929206..22448139e 100644 --- a/tests/mocks/autoloader.php +++ b/tests/mocks/autoloader.php @@ -53,13 +53,24 @@ function autoload($class) $dir = BASEPATH.'libraries'.DIRECTORY_SEPARATOR; $class = $subclass; } + elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) == 3) + { + $driver_path = BASEPATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR; + $dir = $driver_path.$m[1].DIRECTORY_SEPARATOR; + $file = $dir.$m[1].'_'.$m[2].'.php'; + } + elseif (strpos($class, 'CI_DB') === 0) + { + $dir = BASEPATH.'database'.DIRECTORY_SEPARATOR; + $file = $dir.str_replace('CI_DB', 'DB', $subclass).'.php'; + } else { $class = strtolower($class); } } - $file = $dir.$class.'.php'; + $file = (isset($file)) ? $file : $dir.$class.'.php'; if ( ! file_exists($file)) { @@ -71,7 +82,7 @@ function autoload($class) { return FALSE; } - + var_dump($file); throw new InvalidArgumentException("Unable to load $class."); } |