Blame view

vendor/ezyang/htmlpurifier/tests/HTMLPurifier/ChildDef/StrictBlockquoteTest.php 2.38 KB
abf1649b   andryeyev   Чистая установка ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  <?php
  
  class   HTMLPurifier_ChildDef_StrictBlockquoteTest
  extends HTMLPurifier_ChildDefHarness
  {
  
      public function setUp()
      {
          parent::setUp();
          $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
      }
  
      public function testEmptyInput()
      {
          $this->assertResult('');
      }
  
      public function testPreserveValidP()
      {
          $this->assertResult('<p>Valid</p>');
      }
  
      public function testPreserveValidDiv()
      {
          $this->assertResult('<div>Still valid</div>');
      }
  
      public function testWrapTextWithP()
      {
          $this->assertResult('Needs wrap', '<p>Needs wrap</p>');
      }
  
      public function testNoWrapForWhitespaceOrValidElements()
      {
          $this->assertResult('<p>Do not wrap</p>    <p>Whitespace</p>');
      }
  
      public function testWrapTextNextToValidElements()
      {
          $this->assertResult(
                 'Wrap'. '<p>Do not wrap</p>',
              '<p>Wrap</p><p>Do not wrap</p>'
          );
      }
  
      public function testWrapInlineElements()
      {
          $this->assertResult(
              '<p>Do not</p>'.'<b>Wrap</b>',
              '<p>Do not</p><p><b>Wrap</b></p>'
          );
      }
  
      public function testWrapAndRemoveInvalidTags()
      {
          $this->assertResult(
              '<li>Not allowed</li>Paragraph.<p>Hmm.</p>',
              '<p>Not allowedParagraph.</p><p>Hmm.</p>'
          );
      }
  
      public function testWrapComplicatedSring()
      {
          $this->assertResult(
              $var = 'He said<br />perhaps<br />we should <b>nuke</b> them.',
              "<p>$var</p>"
          );
      }
  
      public function testWrapAndRemoveInvalidTagsComplex()
      {
          $this->assertResult(
              '<foo>Bar</foo><bas /><b>People</b>Conniving.'. '<p>Fools!</p>',
                '<p>Bar'.          '<b>People</b>Conniving.</p><p>Fools!</p>'
          );
      }
  
      public function testAlternateWrapper()
      {
          $this->config->set('HTML.BlockWrapper', 'div');
          $this->assertResult('Needs wrap', '<div>Needs wrap</div>');
  
      }
  
      public function testError()
      {
          $this->expectError('Cannot use non-block element as block wrapper');
          $this->obj = new HTMLPurifier_ChildDef_StrictBlockquote('div | p');
          $this->config->set('HTML.BlockWrapper', 'dav');
          $this->config->set('Cache.DefinitionImpl', null);
          $this->assertResult('Needs wrap', '<p>Needs wrap</p>');
      }
  
  }
  
  // vim: et sw=4 sts=4