Docblock update
[htmlpurifier.git] / tests / HTMLPurifier / ChildDef / StrictBlockquoteTest.php
blob82861ee7e630f0dcfe450223997fb6a2b2ae4e92
1 <?php
3 class HTMLPurifier_ChildDef_StrictBlockquoteTest
4 extends HTMLPurifier_ChildDefHarness
7 public function setUp()
9 parent::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()
40 $this->assertResult(
41 'Wrap'. '<p>Do not wrap</p>',
42 '<p>Wrap</p><p>Do not wrap</p>'
46 public function testWrapInlineElements()
48 $this->assertResult(
49 '<p>Do not</p>'.'<b>Wrap</b>',
50 '<p>Do not</p><p><b>Wrap</b></p>'
54 public function testWrapAndRemoveInvalidTags()
56 $this->assertResult(
57 '<li>Not allowed</li>Paragraph.<p>Hmm.</p>',
58 '<p>Not allowedParagraph.</p><p>Hmm.</p>'
62 public function testWrapComplicatedSring()
64 $this->assertResult(
65 $var = 'He said<br />perhaps<br />we should <b>nuke</b> them.',
66 "<p>$var</p>"
70 public function testWrapAndRemoveInvalidTagsComplex()
72 $this->assertResult(
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>');
96 // vim: et sw=4 sts=4