From: Gunnar Wrobel Date: Tue, 24 Aug 2010 08:07:50 +0000 (+0200) Subject: Add a fix to ignore the autoloading of the newer PHPUnit (>= 3.5.0, currently RC). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4edaec11cfcfae661561ea8c28256221f02f5924;p=horde.git Add a fix to ignore the autoloading of the newer PHPUnit (>= 3.5.0, currently RC). Also extracted the reduced Autoloading setup for the test suites. This way I can avoid duplicating code when defining the Autoload.php setup I use for running single test suites. --- diff --git a/framework/Kolab_Config/test/Horde/Kolab/Config/Autoload.php b/framework/Kolab_Config/test/Horde/Kolab/Config/Autoload.php index 0e91eaa6b..ca9ba5921 100644 --- a/framework/Kolab_Config/test/Horde/Kolab/Config/Autoload.php +++ b/framework/Kolab_Config/test/Horde/Kolab/Config/Autoload.php @@ -17,18 +17,7 @@ * @link http://pear.horde.org/index.php?package=Kolab_Config */ -if (!spl_autoload_functions()) { - 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);' - ) - ); -} +require_once 'Horde/Test/Autoload.php'; /** Catch strict standards */ error_reporting(E_ALL | E_STRICT); diff --git a/framework/Test/lib/Horde/Test/AllTests.php b/framework/Test/lib/Horde/Test/AllTests.php index a36574430..6e6a8199b 100644 --- a/framework/Test/lib/Horde/Test/AllTests.php +++ b/framework/Test/lib/Horde/Test/AllTests.php @@ -67,18 +67,7 @@ class Horde_Test_AllTests // Set up autoload $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);' - . '$err_mask = E_ALL ^ E_WARNING;' - . '$oldErrorReporting = error_reporting($err_mask);' - . 'include "$filename.php";' - . 'error_reporting($oldErrorReporting);' - ) - ); - } + require_once 'Horde/Test/Autoload.php'; $suite = new PHPUnit_Framework_TestSuite('Horde Framework - ' . self::$_package); $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/'); diff --git a/framework/Test/lib/Horde/Test/Autoload.php b/framework/Test/lib/Horde/Test/Autoload.php new file mode 100644 index 000000000..d4a6cc1a1 --- /dev/null +++ b/framework/Test/lib/Horde/Test/Autoload.php @@ -0,0 +1,31 @@ + + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @category Horde + * @package Horde_Test + * @subpackage UnitTests + */ +$autoloaders = spl_autoload_functions(); +if (!empty($autoloaders)) { + /** + * Ignore autoloaders which are incapable of loading Horde + * classes (e.g. PHPUnit >= 3.5.0) + */ + $autoloaders = array_diff($autoloaders, array('phpunit_autoload')); +} +if (empty($autoloaders)) { + 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);' + ) + ); +} diff --git a/framework/Test/package.xml b/framework/Test/package.xml index d60d5d433..ee7fcff06 100644 --- a/framework/Test/package.xml +++ b/framework/Test/package.xml @@ -30,6 +30,7 @@ + @@ -54,6 +55,7 @@ +