summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTaufan Aditya <toopay@taufanaditya.com>2012-06-26 22:05:35 +0200
committerTaufan Aditya <toopay@taufanaditya.com>2012-06-26 22:05:35 +0200
commitb8b7dbe7a459c3fe705ca0da8600c1a8544b27cc (patch)
treedbff87c524489173c0578dd2e4150867d959d8d6
parentde6eff04445aeff78ad2e1bbdf7f6f1687653e3e (diff)
Allow extra SPL autoloader
-rw-r--r--tests/mocks/autoloader.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/mocks/autoloader.php b/tests/mocks/autoloader.php
index e3ff7a8bd..1fcba788f 100644
--- a/tests/mocks/autoloader.php
+++ b/tests/mocks/autoloader.php
@@ -69,20 +69,25 @@ function autoload($class)
}
}
- $file = isset($file) ? $file : $dir.$class.'.php';
+ $file = (isset($file)) ? $file : $dir.$class.'.php';
if ( ! file_exists($file))
{
$trace = debug_backtrace();
- // If the autoload call came from `class_exists` or `file_exists`,
- // we skipped and return FALSE
if ($trace[2]['function'] === 'class_exists' OR $trace[2]['function'] === 'file_exists')
{
+ // If the autoload call came from `class_exists` or `file_exists`,
+ // we skipped and return FALSE
+ return FALSE;
+ }
+ elseif (($autoloader = spl_autoload_functions()) && end($autoloader) !== __FUNCTION__)
+ {
+ // If there was other custom autoloader, passed away
return FALSE;
}
- throw new InvalidArgumentException("Unable to load {$class}.");
+ throw new InvalidArgumentException("Unable to load $class.");
}
include_once($file);