mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 14:16:32 +02:00
[2.0.1] Revamp error collector scheme: we now have custom mocks and an exchange of responsibilities
- Fix oversight in AutoParagraph dealing with armor. - Order errors with no line number last - Language object now needs $config and $context objects to do parameterized objects - Auto-close notice added - Token constructors accept line numbers git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1245 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -16,34 +16,44 @@ class HTMLPurifier_Strategy_MakeWellFormed_ErrorsTest extends HTMLPurifier_Strat
|
||||
}
|
||||
|
||||
function testUnnecessaryEndTagRemoved() {
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Unnecessary end tag removed', 'b');
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Unnecessary end tag removed');
|
||||
$this->expectContext('CurrentToken', new HTMLPurifier_Token_End('b', array(), 1));
|
||||
$this->invoke('</b>');
|
||||
}
|
||||
|
||||
function testUnnecessaryEndTagToText() {
|
||||
$this->config->set('Core', 'EscapeInvalidTags', true);
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Unnecessary end tag to text', 'b');
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Unnecessary end tag to text');
|
||||
$this->expectContext('CurrentToken', new HTMLPurifier_Token_End('b', array(), 1));
|
||||
$this->invoke('</b>');
|
||||
}
|
||||
|
||||
function testTagAutoClosed() {
|
||||
$this->expectErrorCollection(E_NOTICE, 'Strategy_MakeWellFormed: Tag auto closed', new HTMLPurifier_Token_Start('b', array(), 1));
|
||||
$this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('div', array(), 1));
|
||||
$this->invoke('<b>Foo<div>Bar</div>');
|
||||
}
|
||||
|
||||
function testStrayEndTagRemoved() {
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Stray end tag removed', 'b');
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Stray end tag removed');
|
||||
$this->expectContext('CurrentToken', new HTMLPurifier_Token_End('b', array(), 1));
|
||||
$this->invoke('<i></b></i>');
|
||||
}
|
||||
|
||||
function testStrayEndTagToText() {
|
||||
$this->config->set('Core', 'EscapeInvalidTags', true);
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Stray end tag to text', 'b');
|
||||
$this->expectErrorCollection(E_WARNING, 'Strategy_MakeWellFormed: Stray end tag to text');
|
||||
$this->expectContext('CurrentToken', new HTMLPurifier_Token_End('b', array(), 1));
|
||||
$this->invoke('<i></b></i>');
|
||||
}
|
||||
|
||||
function testTagClosedByElementEnd() {
|
||||
$this->expectErrorCollection(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by element end', 'b');
|
||||
$this->expectErrorCollection(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by element end', new HTMLPurifier_Token_Start('b', array(), 1));
|
||||
$this->invoke('<i><b>Foobar</i>');
|
||||
}
|
||||
|
||||
function testTagClosedByDocumentEnd() {
|
||||
$this->expectErrorCollection(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by document end', 'b');
|
||||
$this->expectErrorCollection(E_NOTICE, 'Strategy_MakeWellFormed: Tag closed by document end', new HTMLPurifier_Token_Start('b', array(), 1));
|
||||
$this->invoke('<b>Foobar');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user