- Removed tally(), swallowErrors(), assertNoErrors()
[htmlpurifier.git] / tests / HTMLPurifier / ChildDef / StrictBlockquoteTest.php
blob60cf50f37ab3af00b415d3c3a514075fd673e1c0
1 <?php
3 class HTMLPurifier_ChildDef_StrictBlockquoteTest
4 extends HTMLPurifier_ChildDefHarness
7 function setUp() {
8 parent::setUp();
9 $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
12 function testEmptyInput() {
13 $this->assertResult('');
16 function testPreserveValidP() {
17 $this->assertResult('<p>Valid</p>');
20 function testPreserveValidDiv() {
21 $this->assertResult('<div>Still valid</div>');
24 function testWrapTextWithP() {
25 $this->assertResult('Needs wrap', '<p>Needs wrap</p>');
28 function testNoWrapForWhitespaceOrValidElements() {
29 $this->assertResult('<p>Do not wrap</p> <p>Whitespace</p>');
32 function testWrapTextNextToValidElements() {
33 $this->assertResult(
34 'Wrap'. '<p>Do not wrap</p>',
35 '<p>Wrap</p><p>Do not wrap</p>'
39 function testWrapInlineElements() {
40 $this->assertResult(
41 '<p>Do not</p>'.'<b>Wrap</b>',
42 '<p>Do not</p><p><b>Wrap</b></p>'
46 function testWrapAndRemoveInvalidTags() {
47 $this->assertResult(
48 '<li>Not allowed</li>Paragraph.<p>Hmm.</p>',
49 '<p>Not allowedParagraph.</p><p>Hmm.</p>'
53 function testWrapComplicatedSring() {
54 $this->assertResult(
55 $var = 'He said<br />perhaps<br />we should <b>nuke</b> them.',
56 "<p>$var</p>"
60 function testWrapAndRemoveInvalidTagsComplex() {
61 $this->assertResult(
62 '<foo>Bar</foo><bas /><b>People</b>Conniving.'. '<p>Fools!</p>',
63 '<p>Bar'. '<b>People</b>Conniving.</p><p>Fools!</p>'
67 function testAlternateWrapper() {
68 $this->config->set('HTML', 'BlockWrapper', 'div');
69 $this->assertResult('Needs wrap', '<div>Needs wrap</div>');
73 function testError() {
74 // $this->expectError('Cannot use non-block element as block wrapper');
75 $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
76 $this->config->set('HTML', 'BlockWrapper', 'dav');
77 $this->assertResult('Needs wrap', '<p>Needs wrap</p>');