diff --git a/lib/Horde/Test/Autoload.php b/lib/Horde/Test/Autoload.php index f64492c..2344d03 100644 --- a/lib/Horde/Test/Autoload.php +++ b/lib/Horde/Test/Autoload.php @@ -54,10 +54,10 @@ public static function init() spl_autoload_register( function($class) { $filename = Horde_Test_Autoload::resolve($class); - $err_mask = error_reporting() & ~E_WARNING; - $old_err = error_reporting($err_mask); - include "$filename.php"; - error_reporting($old_err); + $path = stream_resolve_include_path($filename); + if ($path) { + include $path; + } }, true, true diff --git a/lib/Horde/Test/Bootstrap.php b/lib/Horde/Test/Bootstrap.php index f5195da..734bb0f 100644 --- a/lib/Horde/Test/Bootstrap.php +++ b/lib/Horde/Test/Bootstrap.php @@ -40,6 +40,7 @@ public static function bootstrap($dir, $no_autoload = false) * We can safely move this before the runonce check * as it will not load the same autoload file twice */ + if (!$no_autoload) { // Find composer autoloader if possible $path = __DIR__; @@ -64,12 +65,15 @@ public static function bootstrap($dir, $no_autoload = false) while ($base != '/' && basename($base) != 'Horde') { $base = dirname($base); } - $base = dirname($base); - if ($base) { - set_include_path( - $base . PATH_SEPARATOR . $base . '/../lib' . PATH_SEPARATOR . get_include_path() - ); + if ($base && $base != '/') { + $include = dirname($base); + $include2 = dirname($include) . '/lib'; + if ($include != $include2) { + $include .= PATH_SEPARATOR . $include2; + } + set_include_path($include . PATH_SEPARATOR . get_include_path()); } + if (!class_exists(\Horde_Test_Autoload::class)) { require_once 'Horde/Test/Autoload.php'; }