1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-07 14:46:48 +02:00

Increase test coverage, and modify handleEnd behavior to only see correct tokens.

Previously, handleEnd was called for any end tag, except ones that were obviously
spurious because there were no parent tags. Now, it is only called for end tags
that are "approved." If an injector operates on the end tag, we automatically
punt. There may be some optimizations that could be made to this procedure,
but for now it's much more consistent.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-10-01 15:40:31 -04:00
parent 1555cb617f
commit 70515dd48f
8 changed files with 166 additions and 10 deletions

View File

@@ -16,9 +16,13 @@ class HTMLPurifier_Strategy_MakeWellFormed_InjectorTest extends HTMLPurifier_Str
$mock = new HTMLPurifier_InjectorMock();
$b = new HTMLPurifier_Token_End('b');
$b->skip = array(0 => true);
$b->start = new HTMLPurifier_Token_Start('b');
$b->start->skip = array(0 => true, 1 => true);
$mock->expectAt(0, 'handleEnd', array($b));
$i = new HTMLPurifier_Token_End('i');
$i->start = new HTMLPurifier_Token_Start('i');
$i->skip = array(0 => true);
$i->start->skip = array(0 => true, 1 => true);
$mock->expectAt(1, 'handleEnd', array($i));
$mock->expectCallCount('handleEnd', 2);
$mock->setReturnValue('getRewind', false);