Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4181a8

Browse files
author
Edward Z. Yang
committed
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
1 parent a1ea149 commit a4181a8

9 files changed

Lines changed: 23 additions & 17 deletions

File tree

maintenance/generate-standalone.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,15 @@ function replace_includes_callback($matches) {
133133

134134
// data files
135135
$FS->mkdirr('standalone/HTMLPurifier/DefinitionCache/Serializer');
136-
make_dir_standalone('HTMLPurifier/EntityLookup');
136+
make_file_standalone('HTMLPurifier/EntityLookup/entities.ser');
137137
make_file_standalone('HTMLPurifier/ConfigSchema/schema.ser');
138138

139139
// non-standard inclusion setup
140+
make_dir_standalone('HTMLPurifier/ConfigSchema');
140141
make_dir_standalone('HTMLPurifier/Language');
141142
make_dir_standalone('HTMLPurifier/Filter');
143+
make_dir_standalone('HTMLPurifier/Printer');
144+
make_file_standalone('HTMLPurifier/Printer.php');
142145
make_file_standalone('HTMLPurifier/Lexer/PH5P.php');
143146
make_file_standalone('HTMLPurifier/Lexer/PEARSax3.php');
144147

tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ function testAlternateWrapper() {
7171
}
7272

7373
function testError() {
74-
// $this->expectError('Cannot use non-block element as block wrapper');
74+
$this->expectError('Cannot use non-block element as block wrapper');
7575
$this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
7676
$this->config->set('HTML', 'BlockWrapper', 'dav');
77+
$this->config->set('Cache', 'DefinitionImpl', null);
7778
$this->assertResult('Needs wrap', '<p>Needs wrap</p>');
7879
}
7980

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[Cake]
2-
Sprinkles = 42
2+
Sprinkles = 42
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[Poem]
2-
Meter = alexandrine
2+
Meter = alexandrine
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[Shortcut]
22
Copy = q
33
Cut = t
4-
Paste = p
4+
Paste = p

tests/HTMLPurifier/Strategy/FixNestingTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ function testRemoveBlockNodeInInlineRootNode() {
106106
function testInvalidParentError() {
107107
// test fallback to div
108108
$this->config->set('HTML', 'Parent', 'obviously-impossible');
109-
// $this->expectError('Cannot use unrecognized element as parent');
109+
$this->config->set('Cache', 'DefinitionImpl', null);
110+
$this->expectError('Cannot use unrecognized element as parent');
110111
$this->assertResult('<div>Accept</div>');
111112
}
112113

tests/common.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,8 @@ function htmlpurifier_flush($php, $reporter) {
215215
function htmlpurifier_dump_error_queue() {
216216
$context = SimpleTest::getContext();
217217
$queue = $context->get('SimpleErrorQueue');
218-
if ($queue && !empty($queue->_queue)) {
219-
// replace this with something prettier
220-
var_dump($queue->_queue);
218+
while (($error = $queue->extract()) !== false) {
219+
var_dump($error);
221220
}
222221
}
223222
register_shutdown_function('htmlpurifier_dump_error_queue');

tests/index.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
define('HTMLPURIFIER_SCHEMA_STRICT', true); // validate schemas
2626
chdir(dirname(__FILE__));
2727

28+
$php = 'php'; // for safety
29+
2830
require 'common.php';
2931

3032
$AC = array(); // parameters
@@ -33,7 +35,7 @@
3335
$AC['file'] = '';
3436
$AC['xml'] = false;
3537
$AC['dry'] = false;
36-
$AC['php'] = 'php';
38+
$AC['php'] = $php;
3739

3840
// Convenience parameters for running quicker tests; ideally all tests
3941
// should be performed.

tests/multitest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*/
2525

2626
define('HTMLPurifierTest', 1);
27+
$php = 'php'; // for safety
28+
2729
require_once 'common.php';
2830

2931
if (!SimpleReporter::inCli()) {
@@ -37,7 +39,7 @@
3739
$AC['file'] = '';
3840
$AC['xml'] = false;
3941
$AC['quiet'] = false;
40-
$AC['php'] = 'php';
42+
$AC['php'] = $php;
4143
$AC['disable-phpt'] = false;
4244
$AC['only-phpt'] = false;
4345
$aliases = array(
@@ -80,15 +82,15 @@
8082
}
8183
if (!$AC['only-phpt']) {
8284
if (!$AC['exclude-normal']) {
83-
$test->addTestCase(
85+
$test->add(
8486
new CliTestCase(
8587
"$phpv $version index.php --xml $flush --disable-phpt $file",
8688
$AC['quiet'], $size
8789
)
8890
);
8991
}
9092
if (!$AC['exclude-standalone']) {
91-
$test->addTestCase(
93+
$test->add(
9294
new CliTestCase(
9395
"$phpv $version index.php --xml $flush --standalone --disable-phpt $file",
9496
$AC['quiet'], $size
@@ -97,7 +99,7 @@
9799
}
98100
}
99101
if (!$AC['disable-phpt']) { // naming is not consistent
100-
$test->addTestCase(
102+
$test->add(
101103
new CliTestCase(
102104
$AC['php'] . " index.php --xml --php \"$phpv $version\" --only-phpt",
103105
$AC['quiet'], $size
@@ -108,8 +110,6 @@
108110

109111
// This is the HTML Purifier website's test XML file. We could
110112
// add more websites, i.e. more configurations to test.
111-
$test->addTestCase(new RemoteTestCase('http://htmlpurifier.org/dev/tests/?xml=1', 'http://htmlpurifier.org/dev/tests/?xml=1&dry=1&flush=1'));
113+
// $test->add(new RemoteTestCase('http://htmlpurifier.org/dev/tests/?xml=1', 'http://htmlpurifier.org/dev/tests/?xml=1&dry=1&flush=1'));
112114

113115
$test->run($reporter);
114-
115-
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');

0 commit comments

Comments
 (0)