0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 16:31:53 +00:00

Various fixes:

- Resync standalone with includes
- Fix error queue code
- Fix heisenbug with flush and certain definition error messages
- Fix premature $end in ini files
- Make $php config variable actually do something

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1659 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2008-04-15 03:33:09 +00:00
parent a1ea149105
commit a4181a80d7
9 changed files with 23 additions and 17 deletions

View File

@ -133,12 +133,15 @@ $FS->rmdirr('standalone'); // ensure a clean copy
// data files
$FS->mkdirr('standalone/HTMLPurifier/DefinitionCache/Serializer');
make_dir_standalone('HTMLPurifier/EntityLookup');
make_file_standalone('HTMLPurifier/EntityLookup/entities.ser');
make_file_standalone('HTMLPurifier/ConfigSchema/schema.ser');
// non-standard inclusion setup
make_dir_standalone('HTMLPurifier/ConfigSchema');
make_dir_standalone('HTMLPurifier/Language');
make_dir_standalone('HTMLPurifier/Filter');
make_dir_standalone('HTMLPurifier/Printer');
make_file_standalone('HTMLPurifier/Printer.php');
make_file_standalone('HTMLPurifier/Lexer/PH5P.php');
make_file_standalone('HTMLPurifier/Lexer/PEARSax3.php');

View File

@ -71,9 +71,10 @@ extends HTMLPurifier_ChildDefHarness
}
function testError() {
// $this->expectError('Cannot use non-block element as block wrapper');
$this->expectError('Cannot use non-block element as block wrapper');
$this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
$this->config->set('HTML', 'BlockWrapper', 'dav');
$this->config->set('Cache', 'DefinitionImpl', null);
$this->assertResult('Needs wrap', '<p>Needs wrap</p>');
}

View File

@ -106,7 +106,8 @@ class HTMLPurifier_Strategy_FixNestingTest extends HTMLPurifier_StrategyHarness
function testInvalidParentError() {
// test fallback to div
$this->config->set('HTML', 'Parent', 'obviously-impossible');
// $this->expectError('Cannot use unrecognized element as parent');
$this->config->set('Cache', 'DefinitionImpl', null);
$this->expectError('Cannot use unrecognized element as parent');
$this->assertResult('<div>Accept</div>');
}

View File

@ -215,9 +215,8 @@ function htmlpurifier_flush($php, $reporter) {
function htmlpurifier_dump_error_queue() {
$context = SimpleTest::getContext();
$queue = $context->get('SimpleErrorQueue');
if ($queue && !empty($queue->_queue)) {
// replace this with something prettier
var_dump($queue->_queue);
while (($error = $queue->extract()) !== false) {
var_dump($error);
}
}
register_shutdown_function('htmlpurifier_dump_error_queue');

View File

@ -25,6 +25,8 @@ define('HTMLPurifierTest', 1);
define('HTMLPURIFIER_SCHEMA_STRICT', true); // validate schemas
chdir(dirname(__FILE__));
$php = 'php'; // for safety
require 'common.php';
$AC = array(); // parameters
@ -33,7 +35,7 @@ $AC['standalone'] = false;
$AC['file'] = '';
$AC['xml'] = false;
$AC['dry'] = false;
$AC['php'] = 'php';
$AC['php'] = $php;
// Convenience parameters for running quicker tests; ideally all tests
// should be performed.

View File

@ -24,6 +24,8 @@
*/
define('HTMLPurifierTest', 1);
$php = 'php'; // for safety
require_once 'common.php';
if (!SimpleReporter::inCli()) {
@ -37,7 +39,7 @@ $AC['exclude-standalone'] = false;
$AC['file'] = '';
$AC['xml'] = false;
$AC['quiet'] = false;
$AC['php'] = 'php';
$AC['php'] = $php;
$AC['disable-phpt'] = false;
$AC['only-phpt'] = false;
$aliases = array(
@ -80,7 +82,7 @@ foreach ($versions_to_test as $version) {
}
if (!$AC['only-phpt']) {
if (!$AC['exclude-normal']) {
$test->addTestCase(
$test->add(
new CliTestCase(
"$phpv $version index.php --xml $flush --disable-phpt $file",
$AC['quiet'], $size
@ -88,7 +90,7 @@ foreach ($versions_to_test as $version) {
);
}
if (!$AC['exclude-standalone']) {
$test->addTestCase(
$test->add(
new CliTestCase(
"$phpv $version index.php --xml $flush --standalone --disable-phpt $file",
$AC['quiet'], $size
@ -97,7 +99,7 @@ foreach ($versions_to_test as $version) {
}
}
if (!$AC['disable-phpt']) { // naming is not consistent
$test->addTestCase(
$test->add(
new CliTestCase(
$AC['php'] . " index.php --xml --php \"$phpv $version\" --only-phpt",
$AC['quiet'], $size
@ -108,8 +110,6 @@ foreach ($versions_to_test as $version) {
// This is the HTML Purifier website's test XML file. We could
// add more websites, i.e. more configurations to test.
$test->addTestCase(new RemoteTestCase('http://htmlpurifier.org/dev/tests/?xml=1', 'http://htmlpurifier.org/dev/tests/?xml=1&dry=1&flush=1'));
// $test->add(new RemoteTestCase('http://htmlpurifier.org/dev/tests/?xml=1', 'http://htmlpurifier.org/dev/tests/?xml=1&dry=1&flush=1'));
$test->run($reporter);
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');