3 class HTMLPurifier_ChildDef_StrictBlockquoteTest
4 extends HTMLPurifier_ChildDefHarness
7 public function setUp()
10 $this->obj
= new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
13 public function testEmptyInput()
15 $this->assertResult('');
18 public function testPreserveValidP()
20 $this->assertResult('<p>Valid</p>');
23 public function testPreserveValidDiv()
25 $this->assertResult('<div>Still valid</div>');
28 public function testWrapTextWithP()
30 $this->assertResult('Needs wrap', '<p>Needs wrap</p>');
33 public function testNoWrapForWhitespaceOrValidElements()
35 $this->assertResult('<p>Do not wrap</p> <p>Whitespace</p>');
38 public function testWrapTextNextToValidElements()
41 'Wrap'. '<p>Do not wrap</p>',
42 '<p>Wrap</p><p>Do not wrap</p>'
46 public function testWrapInlineElements()
49 '<p>Do not</p>'.'<b>Wrap</b>',
50 '<p>Do not</p><p><b>Wrap</b></p>'
54 public function testWrapAndRemoveInvalidTags()
57 '<li>Not allowed</li>Paragraph.<p>Hmm.</p>',
58 '<p>Not allowedParagraph.</p><p>Hmm.</p>'
62 public function testWrapComplicatedSring()
65 $var = 'He said<br />perhaps<br />we should <b>nuke</b> them.',
70 public function testWrapAndRemoveInvalidTagsComplex()
73 '<foo>Bar</foo><bas /><b>People</b>Conniving.'. '<p>Fools!</p>',
74 '<p>Bar'. '<b>People</b>Conniving.</p><p>Fools!</p>'
78 public function testAlternateWrapper()
80 $this->config
->set('HTML.BlockWrapper', 'div');
81 $this->assertResult('Needs wrap', '<div>Needs wrap</div>');
85 public function testError()
87 $this->expectError('Cannot use non-block element as block wrapper');
88 $this->obj
= new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
89 $this->config
->set('HTML.BlockWrapper', 'dav');
90 $this->config
->set('Cache.DefinitionImpl', null);
91 $this->assertResult('Needs wrap', '<p>Needs wrap</p>');