mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 16:31:53 +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:
parent
5c0a1d467a
commit
8c439aa62c
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
if (function_exists('spl_autoload_register')) {
|
if (function_exists('spl_autoload_register')) {
|
||||||
spl_autoload_register(array('HTMLPurifierExtras', 'autoload'));
|
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')) {
|
} elseif (!function_exists('__autoload')) {
|
||||||
function __autoload($class) {return HTMLPurifierExtras::autoload($class);}
|
function __autoload($class) {return HTMLPurifierExtras::autoload($class);}
|
||||||
}
|
}
|
||||||
|
@ -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
|
* Bootstrap class that contains meta-functionality for HTML Purifier such as
|
||||||
* the autoload function.
|
* the autoload function.
|
||||||
@ -56,3 +59,6 @@ class HTMLPurifier_Bootstrap
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ HTMLPurifier.auto.php using spl_autoload_register with __autoload() already defi
|
|||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!function_exists('spl_autoload_register')) {
|
if (!function_exists('spl_autoload_register')) {
|
||||||
echo "skip spl_autoload_register() not available";
|
echo "skip - spl_autoload_register() not available";
|
||||||
}
|
}
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
@ -3,7 +3,7 @@ HTMLPurifier.auto.php using spl_autoload_register with userland spl_autoload reg
|
|||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
if (!function_exists('spl_autoload_register')) {
|
if (!function_exists('spl_autoload_register')) {
|
||||||
echo "skip spl_autoload_register() not available";
|
echo "skip - spl_autoload_register() not available";
|
||||||
}
|
}
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
|
@ -14,13 +14,7 @@ class PHPT_Controller_SimpleTest extends SimpleTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testPhpt() {
|
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));
|
$suite = new PHPT_Suite(array($this->_path));
|
||||||
}
|
|
||||||
// Adapter class that relays messages to SimpleTest
|
|
||||||
$phpt_reporter = new PHPT_Reporter_SimpleTest($this->_reporter);
|
$phpt_reporter = new PHPT_Reporter_SimpleTest($this->_reporter);
|
||||||
$suite->run($phpt_reporter);
|
$suite->run($phpt_reporter);
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,12 @@ if ( is_string($GLOBALS['HTMLPurifierTest']['PEAR']) ) {
|
|||||||
// after external libraries are loaded, turn on compile time errors
|
// after external libraries are loaded, turn on compile time errors
|
||||||
error_reporting(E_ALL | E_STRICT);
|
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
|
// load SimpleTest addon functions
|
||||||
require_once 'generate_mock_once.func.php';
|
require_once 'generate_mock_once.func.php';
|
||||||
require_once 'path2class.func.php';
|
require_once 'path2class.func.php';
|
||||||
|
@ -55,18 +55,13 @@ if (!$AC['disable-phpt']) {
|
|||||||
// clean out cache if necessary
|
// clean out cache if necessary
|
||||||
if ($AC['flush']) shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');
|
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
|
// initialize and load HTML Purifier
|
||||||
// use ?standalone to load the alterative standalone stub
|
// use ?standalone to load the alterative standalone stub
|
||||||
if ($AC['standalone']) {
|
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());
|
set_include_path(realpath('../library/standalone') . PATH_SEPARATOR . realpath('blanks') . PATH_SEPARATOR . get_include_path());
|
||||||
require_once '../library/HTMLPurifier.standalone.php';
|
require_once '../library/HTMLPurifier.standalone.php';
|
||||||
} else {
|
} else {
|
||||||
set_include_path(realpath('../library') . PATH_SEPARATOR . get_include_path() );
|
|
||||||
require_once 'HTMLPurifier.auto.php';
|
|
||||||
require_once 'HTMLPurifier.includes.php';
|
require_once 'HTMLPurifier.includes.php';
|
||||||
}
|
}
|
||||||
require_once 'HTMLPurifier/Harness.php';
|
require_once 'HTMLPurifier/Harness.php';
|
||||||
|
@ -44,6 +44,10 @@ $aliases = array(
|
|||||||
);
|
);
|
||||||
htmlpurifier_parse_args($AC, $aliases);
|
htmlpurifier_parse_args($AC, $aliases);
|
||||||
|
|
||||||
|
// Currently not configurable
|
||||||
|
$AC['disable-phpt'] = false;
|
||||||
|
$AC['only-phpt'] = false;
|
||||||
|
|
||||||
// Calls generate-includes.php automatically
|
// Calls generate-includes.php automatically
|
||||||
shell_exec($AC['php'] . ' ../maintenance/merge-library.php');
|
shell_exec($AC['php'] . ' ../maintenance/merge-library.php');
|
||||||
|
|
||||||
@ -74,8 +78,31 @@ foreach ($versions_to_test as $version) {
|
|||||||
$version = $version[0];
|
$version = $version[0];
|
||||||
$flush = '--flush';
|
$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-normal']) {
|
||||||
if (!$AC['exclude-standalone']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml --standalone --php=\"$phpv $version\" $file", $AC['quiet'], $size));
|
$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
|
// This is the HTML Purifier website's test XML file. We could
|
||||||
|
Loading…
Reference in New Issue
Block a user