Fix autoparagraph bug with non-inline elements.
[htmlpurifier.git] / tests / HTMLPurifier / Strategy / FixNesting_ErrorsTest.php
blob468480774d57c72ebf3fd9e6deb241c3b1444faa
1 <?php
3 class HTMLPurifier_Strategy_FixNesting_ErrorsTest extends HTMLPurifier_Strategy_ErrorsHarness
6 protected function getStrategy() {
7 return new HTMLPurifier_Strategy_FixNesting();
10 function testNodeRemoved() {
11 $this->expectErrorCollection(E_ERROR, 'Strategy_FixNesting: Node removed');
12 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('ul', array(), 1));
13 $this->invoke('<ul></ul>');
16 function testNodeExcluded() {
17 $this->expectErrorCollection(E_ERROR, 'Strategy_FixNesting: Node excluded');
18 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('a', array(), 2));
19 $this->invoke("<a>\n<a></a></a>");
22 function testNodeReorganized() {
23 $this->expectErrorCollection(E_WARNING, 'Strategy_FixNesting: Node reorganized');
24 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('span', array(), 1));
25 $this->invoke("<span>Valid<div>Invalid</div></span>");
28 function testNoNodeReorganizedForEmptyNode() {
29 $this->expectNoErrorCollection();
30 $this->invoke("<span></span>");
33 function testNodeContentsRemoved() {
34 $this->expectErrorCollection(E_ERROR, 'Strategy_FixNesting: Node contents removed');
35 $this->expectContext('CurrentToken', new HTMLPurifier_Token_Start('span', array(), 1));
36 $this->invoke("<span><div></div></span>");
41 // vim: et sw=4 sts=4