From: Gunnar Wrobel
Date: Thu, 11 Feb 2010 13:48:13 +0000 (+0100) Subject: Omit warning during autoloading when an included file does not exist. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=04471f60dcdc8fcd6338d65f2ccfb613abec53f7;p=horde.git Omit warning during autoloading when an included file does not exist. Otherwise some test may fail under strict conditions since class_exists() and new ReflectionClass() suddenly emit a warning for non-existant classes. See tests in Horde_Injector that test for reactions on specifying non existing Instances. --- diff --git a/framework/Test/lib/Horde/Test/AllTests.php b/framework/Test/lib/Horde/Test/AllTests.php index f85863e5c..3357eb022 100644 --- a/framework/Test/lib/Horde/Test/AllTests.php +++ b/framework/Test/lib/Horde/Test/AllTests.php @@ -68,7 +68,16 @@ class Horde_Test_AllTests $basedir = dirname(self::$_file); set_include_path($basedir . '/../../../lib' . PATH_SEPARATOR . get_include_path()); if (!spl_autoload_functions()) { - spl_autoload_register(create_function('$class', '$filename = str_replace(array(\'\\\\\', \'_\'), \'/\', $class); include "$filename.php";')); + spl_autoload_register( + create_function( + '$class', + '$filename = str_replace(array(\'::\', \'_\'), \'/\', $class);' + . '$err_mask = E_ALL ^ E_WARNING;' + . '$oldErrorReporting = error_reporting($err_mask);' + . 'include "$filename.php";' + . 'error_reporting($oldErrorReporting);' + ) + ); } $suite = new PHPUnit_Framework_TestSuite('Horde Framework - ' . self::$_package);