mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-16 02:53:58 +02:00
[3.1.0] Fix broken autoloader, resulting in duplicate classes
- Factor out phpt directory parsing - More phpt tests git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1561 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -35,6 +35,9 @@ $AC['only-phpt'] = false;
|
||||
$aliases = array(
|
||||
'f' => 'file',
|
||||
);
|
||||
|
||||
// It's important that this does not call the autoloader. Not a problem
|
||||
// with a function, but could be if we put this in a class.
|
||||
htmlpurifier_parse_args($AC, $aliases);
|
||||
|
||||
if (!SimpleReporter::inCli()) {
|
||||
@@ -47,17 +50,6 @@ if ($AC['disable-phpt'] && $AC['only-phpt']) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!$AC['disable-phpt']) {
|
||||
$phpt = PHPT_Registry::getInstance();
|
||||
$phpt->php = $AC['php'];
|
||||
}
|
||||
|
||||
if ($AC['flush']) {
|
||||
shell_exec($AC['php'] . ' ../maintenance/generate-schema-cache.php');
|
||||
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');
|
||||
shell_exec($AC['php'] . ' ../maintenance/merge-library.php');
|
||||
}
|
||||
|
||||
// initialize and load HTML Purifier
|
||||
// use ?standalone to load the alterative standalone stub
|
||||
if ($AC['standalone']) {
|
||||
@@ -71,13 +63,37 @@ if ($AC['standalone']) {
|
||||
}
|
||||
require 'HTMLPurifier/Harness.php';
|
||||
|
||||
// Shell-script code is executed
|
||||
|
||||
if ($AC['flush']) {
|
||||
shell_exec($AC['php'] . ' ../maintenance/generate-schema-cache.php');
|
||||
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');
|
||||
shell_exec($AC['php'] . ' ../maintenance/merge-library.php');
|
||||
}
|
||||
|
||||
// Now, userland code begins to be executed
|
||||
|
||||
// setup special DefinitionCacheFactory decorator
|
||||
$factory =& HTMLPurifier_DefinitionCacheFactory::instance();
|
||||
$factory->addDecorator('Memory'); // since we deal with a lot of config objects
|
||||
|
||||
if (!$AC['disable-phpt']) {
|
||||
$phpt = PHPT_Registry::getInstance();
|
||||
$phpt->php = $AC['php'];
|
||||
}
|
||||
|
||||
// load tests
|
||||
$test_files = array();
|
||||
$phpt_dirs = array();
|
||||
require 'test_files.php'; // populates $test_files array
|
||||
// handle phpt files
|
||||
foreach ($phpt_dirs as $dir) {
|
||||
$FS = new FSTools();
|
||||
$phpt_files = $FS->globr($dir, '*.phpt');
|
||||
foreach ($phpt_files as $file) {
|
||||
$test_files[] = str_replace('\\', '/', $file);
|
||||
}
|
||||
}
|
||||
sort($test_files); // for the SELECT
|
||||
$GLOBALS['HTMLPurifierTest']['Files'] = $test_files; // for the reporter
|
||||
$test_file_lookup = array_flip($test_files);
|
||||
|
Reference in New Issue
Block a user