* @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);
// 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, '/');
--- /dev/null
+<?php
+/**
+ * Reduced Horde Autoloader for test suites.
+ *
+ * @author Jan Schneider <jan@horde.org>
+ * @author Gunnar Wrobel <wrobel@pardus.de>
+ * @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);'
+ )
+ );
+}
<dir name="Horde">
<dir name="Test">
<file name="AllTests.php" role="php" />
+ <file name="Autoload.php" role="php" />
<file name="Case.php" role="php" />
<file name="Functional.php" role="php" />
</dir> <!-- /lib/Horde/Test -->
<phprelease>
<filelist>
<install as="Horde/Test/AllTests.php" name="lib/Horde/Test/AllTests.php" />
+ <install as="Horde/Test/Autoload.php" name="lib/Horde/Test/Autoload.php" />
<install as="Horde/Test/Case.php" name="lib/Horde/Test/Case.php" />
<install as="Horde/Test/Functional.php" name="lib/Horde/Test/Functional.php" />
</filelist>