Release 2.1.3, merged in 1404 to HEAD.
[htmlpurifier/bfroehle.git] / tests / HTMLPurifier / Strategy / FixNesting_ErrorsTest.php
blobdb5b989f62da3e947d176eb95cebb7c441de0b7a
1 <?php
3 require_once 'HTMLPurifier/Strategy/ErrorsHarness.php';
4 require_once 'HTMLPurifier/Strategy/FixNesting.php';
6 class HTMLPurifier_Strategy_FixNesting_ErrorsTest extends HTMLPurifier_Strategy_ErrorsHarness
9 function getStrategy() {
10 return new HTMLPurifier_Strategy_FixNesting();
13 function testNodeRemoved() {
14 $this->expectErrorCollection(E_ERROR, 'Strategy_FixNesting: Node removed');
15 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('ul', array(), 1));
16 $this->invoke('<ul></ul>');
19 function testNodeExcluded() {
20 $this->expectErrorCollection(E_ERROR, 'Strategy_FixNesting: Node excluded');
21 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('a', array(), 2));
22 $this->invoke("<a>\n<a></a></a>");
25 function testNodeReorganized() {
26 $this->expectErrorCollection(E_WARNING, 'Strategy_FixNesting: Node reorganized');
27 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('span', array(), 1));
28 $this->invoke("<span>Valid<div>Invalid</div></span>");
31 function testNoNodeReorganizedForEmptyNode() {
32 $this->expectNoErrorCollection();
33 $this->invoke("<span></span>");
36 function testNodeContentsRemoved() {
37 $this->expectErrorCollection(E_ERROR, 'Strategy_FixNesting: Node contents removed');
38 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('span', array(), 1));
39 $this->invoke("<span><div></div></span>");