summaryrefslogtreecommitdiffstats
path: root/tests/mocks/autoloader.php
diff options
context:
space:
mode:
authorTimothy Warren <tim@timshomepage.net>2012-04-26 23:58:56 +0200
committerTimothy Warren <tim@timshomepage.net>2012-04-26 23:58:56 +0200
commit042766bac61958a21ba5d6b3c53b0e4296fdcce7 (patch)
treedf9e26699ddb5d3841a0d1cc1795913c819bf611 /tests/mocks/autoloader.php
parent0688ac9ad88a03f1c56cfcd9e3c475b83301344d (diff)
parent61318a2c53c13a314f483fcbbfd64c6e01f5242c (diff)
Merge branch 'develop' of git://github.com/EllisLab/CodeIgniter into library-cleanup
Diffstat (limited to 'tests/mocks/autoloader.php')
-rw-r--r--tests/mocks/autoloader.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index dd5929206..f1bdb5d6f 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(array('CI_DB','active_record'), array('DB', 'active_rec'), $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;
}
-
+
throw new InvalidArgumentException("Unable to load $class.");
}