diff --git a/extras/HTMLPurifierExtras.autoload.php b/extras/HTMLPurifierExtras.autoload.php index f228c554..8ee9f37a 100644 --- a/extras/HTMLPurifierExtras.autoload.php +++ b/extras/HTMLPurifierExtras.autoload.php @@ -2,6 +2,10 @@ if (function_exists('spl_autoload_register')) { spl_autoload_register(array('HTMLPurifierExtras', 'autoload')); + if (function_exists('__autoload')) { + // be polite and ensure that userland autoload gets retained + spl_autoload_register('__autoload'); + } } elseif (!function_exists('__autoload')) { function __autoload($class) {return HTMLPurifierExtras::autoload($class);} } diff --git a/library/HTMLPurifier/Bootstrap.php b/library/HTMLPurifier/Bootstrap.php index 672ec5f4..1d4e81d3 100644 --- a/library/HTMLPurifier/Bootstrap.php +++ b/library/HTMLPurifier/Bootstrap.php @@ -20,6 +20,9 @@ if (!defined('PHP_EOL')) { } } +// :TODO: Might be slow +if (!class_exists('HTMLPurifier_Bootstrap', false)) { + /** * Bootstrap class that contains meta-functionality for HTML Purifier such as * the autoload function. @@ -56,3 +59,6 @@ class HTMLPurifier_Bootstrap } } + +} + diff --git a/tests/HTMLPurifier/PHPT/loading/auto-with-autoload.phpt b/tests/HTMLPurifier/PHPT/loading/auto-with-autoload.phpt index 3645d367..e62168bd 100644 --- a/tests/HTMLPurifier/PHPT/loading/auto-with-autoload.phpt +++ b/tests/HTMLPurifier/PHPT/loading/auto-with-autoload.phpt @@ -3,7 +3,7 @@ HTMLPurifier.auto.php using spl_autoload_register with __autoload() already defi --SKIPIF-- _path)) { - $factory = new PHPT_Suite_Factory(); - $suite = $factory->factory($this->_path, true); - } else { - $suite = new PHPT_Suite(array($this->_path)); - } - // Adapter class that relays messages to SimpleTest + $suite = new PHPT_Suite(array($this->_path)); $phpt_reporter = new PHPT_Reporter_SimpleTest($this->_reporter); $suite->run($phpt_reporter); } diff --git a/tests/common.php b/tests/common.php index 3265aff6..7c31f042 100644 --- a/tests/common.php +++ b/tests/common.php @@ -57,6 +57,12 @@ if ( is_string($GLOBALS['HTMLPurifierTest']['PEAR']) ) { // after external libraries are loaded, turn on compile time errors error_reporting(E_ALL | E_STRICT); +// initialize HTML Purifier +require_once '../library/HTMLPurifier.auto.php'; + +// initialize alternative classes +require_once '../extras/HTMLPurifierExtras.auto.php'; + // load SimpleTest addon functions require_once 'generate_mock_once.func.php'; require_once 'path2class.func.php'; diff --git a/tests/index.php b/tests/index.php index 0591d939..1884e9d7 100755 --- a/tests/index.php +++ b/tests/index.php @@ -55,18 +55,13 @@ if (!$AC['disable-phpt']) { // clean out cache if necessary if ($AC['flush']) shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php'); -// initialize and load alternative classes -require_once '../extras/HTMLPurifierExtras.auto.php'; - - // initialize and load HTML Purifier // use ?standalone to load the alterative standalone stub if ($AC['standalone']) { + // :TODO: This line is pretty important; please document! set_include_path(realpath('../library/standalone') . PATH_SEPARATOR . realpath('blanks') . PATH_SEPARATOR . get_include_path()); require_once '../library/HTMLPurifier.standalone.php'; } else { - set_include_path(realpath('../library') . PATH_SEPARATOR . get_include_path() ); - require_once 'HTMLPurifier.auto.php'; require_once 'HTMLPurifier.includes.php'; } require_once 'HTMLPurifier/Harness.php'; diff --git a/tests/multitest.php b/tests/multitest.php index f562e502..8f2e631c 100644 --- a/tests/multitest.php +++ b/tests/multitest.php @@ -44,6 +44,10 @@ $aliases = array( ); htmlpurifier_parse_args($AC, $aliases); +// Currently not configurable +$AC['disable-phpt'] = false; +$AC['only-phpt'] = false; + // Calls generate-includes.php automatically shell_exec($AC['php'] . ' ../maintenance/merge-library.php'); @@ -74,8 +78,31 @@ foreach ($versions_to_test as $version) { $version = $version[0]; $flush = '--flush'; } - if (!$AC['exclude-normal']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml $flush --php=\"$phpv $version\" $file", $AC['quiet'], $size)); - if (!$AC['exclude-standalone']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml --standalone --php=\"$phpv $version\" $file", $AC['quiet'], $size)); + if (!$AC['exclude-normal']) { + $test->addTestCase( + new CliTestCase( + "$phpv $version index.php --xml $flush --disable-phpt $file", + $AC['quiet'], $size + ) + ); + } + if (!$AC['exclude-standalone']) { + $test->addTestCase( + new CliTestCase( + "$phpv $version index.php --xml $flush --standalone --disable-phpt $file", + $AC['quiet'], $size + ) + ); + } + // naming is inconsistent: + //if (!$AC['disable-phpt']) { + $test->addTestCase( + new CliTestCase( + $AC['php'] . " index.php --xml --php=\"$phpv $version\" --only-phpt", + $AC['quiet'], $size + ) + ); + //} } // This is the HTML Purifier website's test XML file. We could