0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 08:21:52 +00:00

[3.1.0] multitest.php now works again for all version, however, some hacks to PHPT are required

- Bootstrap hotfix to prevent multiple loading in standalone. We need a better way of doing this!
- Make extras/ autoloader polite too
- Initialize autoloaders in common.php
- Add trailing dash to "skip" in phpt
- Upgrade SimpleTest.php not to allow directories

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1554 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2008-02-16 18:03:51 +00:00
parent 5c0a1d467a
commit 8c439aa62c
8 changed files with 49 additions and 17 deletions

View File

@ -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);}
}

View File

@ -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
}
}
}

View File

@ -3,7 +3,7 @@ HTMLPurifier.auto.php using spl_autoload_register with __autoload() already defi
--SKIPIF--
<?php
if (!function_exists('spl_autoload_register')) {
echo "skip spl_autoload_register() not available";
echo "skip - spl_autoload_register() not available";
}
--FILE--
<?php

View File

@ -3,7 +3,7 @@ HTMLPurifier.auto.php using spl_autoload_register with userland spl_autoload reg
--SKIPIF--
<?php
if (!function_exists('spl_autoload_register')) {
echo "skip spl_autoload_register() not available";
echo "skip - spl_autoload_register() not available";
}
--FILE--
<?php

View File

@ -14,13 +14,7 @@ class PHPT_Controller_SimpleTest extends SimpleTestCase
}
public function testPhpt() {
if (is_dir($this->_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);
}

View File

@ -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';

View File

@ -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';

View File

@ -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