‪TYPO3CMS  10.4
HtmlParserTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪HtmlParserTest extends UnitTestCase
27 {
31  protected ‪$subject;
32 
33  protected function ‪setUp(): void
34  {
35  parent::setUp();
36  $this->subject = new ‪HtmlParser();
37  }
38 
42  public function ‪cDataWillRemainUnmodifiedDataProvider(): array
43  {
44  return [
45  'single-line CDATA' => [
46  '/*<![CDATA[*/ <hello world> /*]]>*/',
47  '/*<![CDATA[*/ <hello world> /*]]>*/',
48  ],
49  'multi-line CDATA #1' => [
50  '/*<![CDATA[*/' . LF . '<hello world> /*]]>*/',
51  '/*<![CDATA[*/' . LF . '<hello world> /*]]>*/',
52  ],
53  'multi-line CDATA #2' => [
54  '/*<![CDATA[*/ <hello world>' . LF . '/*]]>*/',
55  '/*<![CDATA[*/ <hello world>' . LF . '/*]]>*/',
56  ],
57  'multi-line CDATA #3' => [
58  '/*<![CDATA[*/' . LF . '<hello world>' . LF . '/*]]>*/',
59  '/*<![CDATA[*/' . LF . '<hello world>' . LF . '/*]]>*/',
60  ],
61  ];
62  }
63 
69  public function ‪splitIntoBlockDataProvider(): array
70  {
71  return [
72  'splitBlock' => [
73  'h1,span',
74  '<body><h1>Title</h1><span>Note</span></body>',
75  false,
76  [
77  '<body>',
78  '<h1>Title</h1>',
79  '',
80  '<span>Note</span>',
81  '</body>'
82  ]
83  ],
84  'splitBlock br' => [
85  'h1,span',
86  '<body><h1>Title</h1><br /><span>Note</span><br /></body>',
87  false,
88  [
89  '<body>',
90  '<h1>Title</h1>',
91  '<br />',
92  '<span>Note</span>',
93  '<br /></body>'
94  ]
95  ],
96  'splitBlock with attribute' => [
97  'h1,span',
98  '<body><h1 class="title">Title</h1><span>Note</span></body>',
99  false,
100  [
101  '<body>',
102  '<h1 class="title">Title</h1>',
103  '',
104  '<span>Note</span>',
105  '</body>'
106  ]
107  ],
108  'splitBlock span with attribute' => [
109  'span',
110  '<body><h1>Title</h1><span class="title">Note</span></body>',
111  false,
112  [
113  '<body><h1>Title</h1>',
114  '<span class="title">Note</span>',
115  '</body>'
116  ]
117  ],
118  'splitBlock without extra end tags' => [
119  'h1,span,div',
120  '<body><h1>Title</h1><span>Note</span></body></div>',
121  true,
122  [
123  '<body>',
124  '<h1>Title</h1>',
125  '',
126  '<span>Note</span>',
127  '</body>'
128  ]
129  ],
130  ];
131  }
132 
141  public function ‪splitIntoBlock(string $tag, string $content, bool $eliminateExtraEndTags, array $expected): void
142  {
143  self::assertSame($expected, $this->subject->splitIntoBlock($tag, $content, $eliminateExtraEndTags));
144  }
145 
152  public function ‪xHtmlCleaningDoesNotModifyCDATA(string $source, string $expected): void
153  {
154  $result = $this->subject->HTMLcleaner($source, [], 1);
155  self::assertSame($expected, $result);
156  }
157 
162  {
163  return [
164  'Span tag with no attrib' => [
165  '<span>text</span>',
166  'text'
167  ],
168  'Span tag with allowed id attrib' => [
169  '<span id="id">text</span>',
170  '<span id="id">text</span>'
171  ],
172  'Span tag with disallowed style attrib' => [
173  '<span style="line-height: 12px;">text</span>',
174  'text'
175  ]
176  ];
177  }
178 
185  public function ‪tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured(string $content, string $expectedResult): void
186  {
187  $tsConfig = [
188  'allowTags' => 'span',
189  'tags.' => [
190  'span.' => [
191  'allowedAttribs' => 'id',
192  'rmTagIfNoAttrib' => 1
193  ]
194  ]
195  ];
196  self::assertEquals($expectedResult, $this->‪parseConfigAndCleanHtml($tsConfig, $content));
197  }
198 
203  {
204  $tsConfig = [
205  'allowTags' => 'div,span',
206  'rmTagIfNoAttrib' => 'span',
207  'globalNesting' => 'div,span'
208  ];
209  $content = '<span></span><span id="test"><div></span></div>';
210  $expectedResult = '<span id="test"></span>';
211  self::assertEquals($expectedResult, $this->‪parseConfigAndCleanHtml($tsConfig, $content));
212  }
213 
219  public static function ‪localNestingCorrectlyRemovesInvalidTagsDataProvider(): array
220  {
221  return [
222  'Valid nesting is untouched' => [
223  '<B><I></B></I>',
224  '<B><I></B></I>'
225  ],
226  'Valid nesting with content is untouched' => [
227  'testa<B>test1<I>test2</B>test3</I>testb',
228  'testa<B>test1<I>test2</B>test3</I>testb'
229  ],
230  'Superfluous tags are removed' => [
231  '</B><B><I></B></I></B>',
232  '<B><I></B></I>'
233  ],
234  'Superfluous tags with content are removed' => [
235  'test1</B>test2<B>test3<I>test4</B>test5</I>test6</B>test7',
236  'test1test2<B>test3<I>test4</B>test5</I>test6test7'
237  ],
238  'Another valid nesting test' => [
239  '<span><div></span></div>',
240  '<span><div></span></div>',
241  ],
242  ];
243  }
244 
251  public function ‪localNestingCorrectlyRemovesInvalidTags(string $content, string $expectedResult): void
252  {
253  $tsConfig = [
254  'allowTags' => 'div,span,b,i',
255  'localNesting' => 'div,span,b,i',
256  ];
257  self::assertEquals($expectedResult, $this->‪parseConfigAndCleanHtml($tsConfig, $content));
258  }
259 
265  public static function ‪globalNestingCorrectlyRemovesInvalidTagsDataProvider(): array
266  {
267  return [
268  'Valid nesting is untouched' => [
269  '<B><I></I></B>',
270  '<B><I></I></B>'
271  ],
272  'Valid nesting with content is untouched' => [
273  'testa<B>test1<I>test2</I>test3</B>testb',
274  'testa<B>test1<I>test2</I>test3</B>testb'
275  ],
276  'Invalid nesting is cleaned' => [
277  '</B><B><I></B></I></B>',
278  '<B></B>'
279  ],
280  'Invalid nesting with content is cleaned' => [
281  'test1</B>test2<B>test3<I>test4</B>test5</I>test6</B>test7',
282  'test1test2<B>test3test4</B>test5test6test7'
283  ],
284  'Another invalid nesting test' => [
285  '<span><div></span></div>',
286  '<span></span>',
287  ],
288  ];
289  }
290 
297  public function ‪globalNestingCorrectlyRemovesInvalidTags(string $content, string $expectedResult): void
298  {
299  $tsConfig = [
300  'allowTags' => 'span,div,b,i',
301  'globalNesting' => 'span,div,b,i',
302  ];
303  self::assertEquals($expectedResult, $this->‪parseConfigAndCleanHtml($tsConfig, $content));
304  }
305 
309  public function ‪emptyTagsDataProvider(): array
310  {
311  return [
312  [false, null, false, '<h1></h1>', '<h1></h1>'],
313  [true, null, false, '<h1></h1>', ''],
314  [true, null, false, '<h1>hallo</h1>', '<h1>hallo</h1>'],
315  [true, null, false, '<h1 class="something"></h1>', ''],
316  [true, null, false, '<h1 class="something"></h1><h2></h2>', ''],
317  [true, 'h2', false, '<h1 class="something"></h1><h2></h2>', '<h1 class="something"></h1>'],
318  [true, 'h2, h1', false, '<h1 class="something"></h1><h2></h2>', ''],
319  [true, null, false, '<div><p></p></div>', ''],
320  [true, null, false, '<div><p>&nbsp;</p></div>', '<div><p>&nbsp;</p></div>'],
321  [true, null, true, '<div><p>&nbsp;&nbsp;</p></div>', ''],
322  [true, null, true, '<div>&nbsp;&nbsp;<p></p></div>', ''],
323  [true, null, false, '<div>Some content<p></p></div>', '<div>Some content</div>'],
324  [true, null, true, '<div>Some content<p></p></div>', '<div>Some content</div>'],
325  [true, null, false, '<div>Some content</div>', '<div>Some content</div>'],
326  [true, null, true, '<div>Some content</div>', '<div>Some content</div>'],
327  [true, null, false, '<a href="#skiplinks">Skiplinks </a><b></b>', '<a href="#skiplinks">Skiplinks </a>'],
328  [true, null, true, '<a href="#skiplinks">Skiplinks </a><b></b>', '<a href="#skiplinks">Skiplinks </a>'],
329  [false, '', false, '<h1></h1>', '<h1></h1>'],
330  [true, '', false, '<h1></h1>', ''],
331  [true, '', false, '<h1>hallo</h1>', '<h1>hallo</h1>'],
332  [true, '', false, '<h1 class="something"></h1>', ''],
333  [true, '', false, '<h1 class="something"></h1><h2></h2>', ''],
334  [true, '', false, '<div><p></p></div>', ''],
335  [true, '', false, '<div><p>&nbsp;</p></div>', '<div><p>&nbsp;</p></div>'],
336  [true, '', true, '<div><p>&nbsp;&nbsp;</p></div>', ''],
337  [true, '', true, '<div>&nbsp;&nbsp;<p></p></div>', ''],
338  [true, '', false, '<div>Some content<p></p></div>', '<div>Some content</div>'],
339  [true, '', true, '<div>Some content<p></p></div>', '<div>Some content</div>'],
340  [true, '', false, '<div>Some content</div>', '<div>Some content</div>'],
341  [true, '', true, '<div>Some content</div>', '<div>Some content</div>'],
342  [true, '', false, '<a href="#skiplinks">Skiplinks </a><b></b>', '<a href="#skiplinks">Skiplinks </a>'],
343  [true, '', true, '<a href="#skiplinks">Skiplinks </a><b></b>', '<a href="#skiplinks">Skiplinks </a>'],
344  ];
345  }
346 
356  public function ‪stripEmptyTags(
357  bool $stripOn,
358  $tagList,
359  bool $treatNonBreakingSpaceAsEmpty,
360  string $content,
361  string $expectedResult
362  ): void {
363  $tsConfig = [
364  'keepNonMatchedTags' => 1,
365  'stripEmptyTags' => $stripOn,
366  'stripEmptyTags.' => [
367  'tags' => $tagList,
368  'treatNonBreakingSpaceAsEmpty' => $treatNonBreakingSpaceAsEmpty
369  ],
370  ];
371 
372  $result = $this->‪parseConfigAndCleanHtml($tsConfig, $content);
373  self::assertEquals($expectedResult, $result);
374  }
375 
379  public function ‪stripEmptyTagsKeepsConfiguredTagsDataProvider(): array
380  {
381  return [
382  [
383  'tr,td',
384  false,
385  '<div><p><tr><td></td></tr></p></div><div class="test"></div><tr></tr><p></p><td></td><i></i>',
386  '<div><p><tr><td></td></tr></p></div><tr></tr><td></td>'
387  ],
388  [
389  'tr,td',
390  true,
391  '<div><p><tr><td></td></tr></p></div><p class="test"> &nbsp; </p><tr></tr><p></p><td></td><i></i>',
392  '<div><p><tr><td></td></tr></p></div><tr></tr><td></td>'
393  ],
394  ];
395  }
396 
405  public function ‪stripEmptyTagsKeepsConfiguredTags(
406  string $tagList,
407  bool $treatNonBreakingSpaceAsEmpty,
408  string $content,
409  string $expectedResult
410  ): void {
411  $tsConfig = [
412  'keepNonMatchedTags' => 1,
413  'stripEmptyTags' => 1,
414  'stripEmptyTags.' => [
415  'keepTags' => $tagList,
416  'treatNonBreakingSpaceAsEmpty' => $treatNonBreakingSpaceAsEmpty
417  ],
418  ];
419 
420  $result = $this->‪parseConfigAndCleanHtml($tsConfig, $content);
421  self::assertEquals($expectedResult, $result);
422  }
423 
431  protected function ‪parseConfigAndCleanHtml(array $tsConfig, string $content): string
432  {
433  $config = $this->subject->HTMLparserConfig($tsConfig);
434  return $this->subject->HTMLcleaner($content, $config[0], $config[1], $config[2], $config[3]);
435  }
436 
442  public function ‪getFirstTagDataProvider(): array
443  {
444  return [
445  ['<body><span></span></body>', '<body>'],
446  ['<span>Wrapper<div>Some content</div></span>', '<span>'],
447  ['Something before<span>Wrapper<div>Some content</div></span>Something after', 'Something before<span>'],
448  ['Something without tag', ''],
449  ['text</span>', 'text</span>'],
450  ['<span class=<other><inner></span>', '<span class=<other>'],
451  ['<sp-an class=<other><inner></sp-an>', '<sp-an class=<other>'],
452  ['<span/class=<other><inner></span>', '<span/class=<other>'],
453  ['<span class="<other>"><inner></span>', '<span class="<other>">'],
454  ['<span class=""<other>""><inner></span>', '<span class=""<other>'],
455  ['<span class=<other>>><inner></span>', '<span class=<other>'],
456  ['<span class="', ''],
457  ['<span class=""', ''],
458  ['<span class="<"', ''],
459  ['<span class=">"', ''],
460  ['<span class="<other><inner></span>', ''],
461  ["<span class='<other><inner></span>", ''],
462  ['<span class="<other>\'<inner></span>', ''],
463  ["<span class='<other>\"<inner></span>", ''],
464  ];
465  }
466 
477  public function ‪getFirstTag(string $str, string $expected): void
478  {
479  self::assertEquals($expected, $this->subject->getFirstTag($str));
480  }
481 
487  public function ‪getFirstTagNameDataProvider(): array
488  {
489  return [
490  [
491  '<body><span></span></body>',
492  false,
493  'BODY'
494  ],
495  [
496  '<body><span></span></body>',
497  true,
498  'body'
499  ],
500  [
501  '<div class="test"><span></span></div>',
502  false,
503  'DIV'
504  ],
505  [
506  '<div><span class="test"></span></div>',
507  false,
508  'DIV'
509  ],
510  [
511  '<br /><span class="test"></span>',
512  false,
513  'BR'
514  ],
515  [
516  '<img src="test.jpg" />',
517  false,
518  'IMG'
519  ],
520  ['text</span>', false, ''],
521  ['<span class=<other><inner></span>', false, 'SPAN'],
522  ['<sp-an class=<other><inner></sp-an>', false, 'SP-AN'],
523  ['<span/class=<other><inner></span>', false, 'SPAN'],
524  ['<span class="<other>"><inner></span>', false, 'SPAN'],
525  ['<span class=""<other>""><inner></span>', false, 'SPAN'],
526  ['<span class=<other>>><inner></span>', false, 'SPAN'],
527  ['<span class="', false, ''],
528  ['<span class=""', false, ''],
529  ['<span class="<"', false, ''],
530  ['<span class=">"', false, ''],
531  ['<span class="<other><inner></span>', false, ''],
532  ["<span class='<other><inner></span>", false, ''],
533  ['<span class="<other>\'<inner></span>', false, ''],
534  ["<span class='<other>\"<inner></span>", false, ''],
535 
536  ];
537  }
538 
549  public function ‪getFirstTagName(string $str, bool $preserveCase, string $expected): void
550  {
551  self::assertEquals($expected, $this->subject->getFirstTagName($str, $preserveCase));
552  }
553 
557  public function ‪removeFirstAndLastTagDataProvider(): array
558  {
559  return [
560  ['<span>Wrapper<div>Some content</div></span>', 'Wrapper<div>Some content</div>'],
561  ['<td><tr>Some content</tr></td>', '<tr>Some content</tr>'],
562  [
563  'Something before<span>Wrapper<div>Some content</div></span>Something after',
564  'Wrapper<div>Some content</div>'
565  ],
566  ['<span class="hidden">Wrapper<div>Some content</div></span>', 'Wrapper<div>Some content</div>'],
567  [
568  '<span>Wrapper<div class="hidden">Some content</div></span>',
569  'Wrapper<div class="hidden">Some content</div>'
570  ],
571  [
572  'Some stuff before <span>Wrapper<div class="hidden">Some content</div></span> and after',
573  'Wrapper<div class="hidden">Some content</div>'
574  ],
575  ['text', ''],
576  ['<span>text', ''],
577  ['text</span>', ''],
578  ['<span class=<other><inner></span>', '<inner>'],
579  ['<sp-an class=<other><inner></sp-an>', '<inner>'],
580  ['<span/class=<other><inner></span>', '<inner>'],
581  ['<span class="<other>"><inner></span>', '<inner>'],
582  ['<span class=""<other>""><inner></span>', '""><inner>'],
583  ['<span class=<other>>><inner></span>', '>><inner>'],
584  ['<span class="', ''],
585  ['<span class=""', ''],
586  ['<span class="<"', ''],
587  ['<span class=">"', ''],
588  ['<span class="<other><inner></span>', ''],
589  ["<span class='<other><inner></span>", ''],
590  ['<span class="<other>\'<inner></span>', ''],
591  ["<span class='<other>\"<inner></span>", ''],
592  ];
593  }
594 
604  public function ‪removeFirstAndLastTag(string $str, string $expectedResult): void
605  {
606  self::assertEquals($expectedResult, $this->subject->removeFirstAndLastTag($str));
607  }
608 
612  public function ‪getTagAttributesDataProvider(): array
613  {
614  return [
615  [
616  '<a href="" data-shortCut="DXB" required>',
617  [
618  ['href' => '', 'data-shortcut' => 'DXB', 'required' => ''],
619  [
620  'href' => ['origTag' => 'href', 'dashType' => '"'],
621  'data-shortcut' => ['origTag' => 'data-shortCut', 'dashType' => '"'],
622  'required' => ['origTag' => 'required']
623  ]
624  ]
625  ],
626  [
627  '<ul STYLE=\'background-image: (url: "fra.png")\' data-shortcut=FRA>',
628  [
629  ['style' => 'background-image: (url: "fra.png")', 'data-shortcut' => 'FRA'],
630  [
631  'style' => ['origTag' => 'STYLE', 'dashType' => '\''],
632  'data-shortcut' => ['origTag' => 'data-shortcut', 'dashType' => '']
633  ]
634  ]
635  ]
636 
637  ];
638  }
639 
649  public function ‪getTagAttributes(string $tag, array $expectedResult): void
650  {
651  self::assertEquals($expectedResult, $this->subject->get_tag_attributes($tag));
652  }
653 
657  public function ‪stripEmptyTagsDataProvider(): array
658  {
659  return [
660  // Testing wrongly encapsulated and upper/lowercase tags
661  [
662  '<div>Denpassar</div><p> Bali</P><p></p><P></p><ul><li></li></ul>',
663  '',
664  false,
665  '<div>Denpassar</div><p> Bali</P>'
666  ],
667  // Testing incomplete tags
668  [
669  '<p><div>Klungklung</div></p><p> Semarapura<p></p><p></p><ul><li></li></ul>',
670  '',
671  false,
672  '<p><div>Klungklung</div></p><p> Semarapura'
673  ],
674  // Testing third parameter (break spaces
675  [
676  '<p><div>Badung</div></p><ul> Mangupura<p></p><p></p><ul><li>&nbsp;</li><li>Uluwatu</li></ul>',
677  '',
678  true,
679  '<p><div>Badung</div></p><ul> Mangupura<ul><li>Uluwatu</li></ul>'
680  ],
681  // Testing fourth parameter (keeping empty other tags, keeping defined used tags)
682  [
683  '<p><div>Badung</div></p><ul> Mangupura<p></p><p></p><ul><li></li></ul>',
684  'p,div',
685  true,
686  '<p><div>Badung</div></p><ul> Mangupura<ul><li></li></ul>'
687  ],
688 
689  ];
690  }
691 
703  public function ‪rawStripEmptyTagsTest(
704  string $content,
705  string $tagList,
706  bool $treatNonBreakingSpaceAsEmpty,
707  string $expectedResult
708  ): void {
709  self::assertEquals(
710  $expectedResult,
711  $this->subject->stripEmptyTags($content, $tagList, $treatNonBreakingSpaceAsEmpty)
712  );
713  }
714 }
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\localNestingCorrectlyRemovesInvalidTags
‪localNestingCorrectlyRemovesInvalidTags(string $content, string $expectedResult)
Definition: HtmlParserTest.php:250
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\stripEmptyTagsKeepsConfiguredTags
‪stripEmptyTagsKeepsConfiguredTags(string $tagList, bool $treatNonBreakingSpaceAsEmpty, string $content, string $expectedResult)
Definition: HtmlParserTest.php:404
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\splitIntoBlock
‪splitIntoBlock(string $tag, string $content, bool $eliminateExtraEndTags, array $expected)
Definition: HtmlParserTest.php:140
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\xHtmlCleaningDoesNotModifyCDATA
‪xHtmlCleaningDoesNotModifyCDATA(string $source, string $expected)
Definition: HtmlParserTest.php:151
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\spanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfiguredDataProvider
‪static spanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfiguredDataProvider()
Definition: HtmlParserTest.php:160
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\setUp
‪setUp()
Definition: HtmlParserTest.php:32
‪TYPO3\CMS\Core\Html\HtmlParser
Definition: HtmlParser.php:27
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\getFirstTagNameDataProvider
‪array getFirstTagNameDataProvider()
Definition: HtmlParserTest.php:486
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\cDataWillRemainUnmodifiedDataProvider
‪array cDataWillRemainUnmodifiedDataProvider()
Definition: HtmlParserTest.php:41
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\getFirstTag
‪getFirstTag(string $str, string $expected)
Definition: HtmlParserTest.php:476
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\globalNestingCorrectlyRemovesInvalidTags
‪globalNestingCorrectlyRemovesInvalidTags(string $content, string $expectedResult)
Definition: HtmlParserTest.php:296
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\removeFirstAndLastTag
‪removeFirstAndLastTag(string $str, string $expectedResult)
Definition: HtmlParserTest.php:603
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\$subject
‪TYPO3 CMS Core Html HtmlParser $subject
Definition: HtmlParserTest.php:30
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\globalNestingCorrectlyRemovesInvalidTagsDataProvider
‪static array globalNestingCorrectlyRemovesInvalidTagsDataProvider()
Definition: HtmlParserTest.php:264
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\stripEmptyTagsKeepsConfiguredTagsDataProvider
‪array stripEmptyTagsKeepsConfiguredTagsDataProvider()
Definition: HtmlParserTest.php:378
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest
Definition: HtmlParserTest.php:27
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\getFirstTagName
‪getFirstTagName(string $str, bool $preserveCase, string $expected)
Definition: HtmlParserTest.php:548
‪TYPO3\CMS\Core\Tests\Unit\Html
Definition: HtmlParserTest.php:18
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\stripEmptyTagsDataProvider
‪array stripEmptyTagsDataProvider()
Definition: HtmlParserTest.php:656
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\emptyTagsDataProvider
‪array emptyTagsDataProvider()
Definition: HtmlParserTest.php:308
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\stripEmptyTags
‪stripEmptyTags(bool $stripOn, $tagList, bool $treatNonBreakingSpaceAsEmpty, string $content, string $expectedResult)
Definition: HtmlParserTest.php:355
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured
‪tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured(string $content, string $expectedResult)
Definition: HtmlParserTest.php:184
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\getTagAttributes
‪getTagAttributes(string $tag, array $expectedResult)
Definition: HtmlParserTest.php:648
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\getTagAttributesDataProvider
‪array getTagAttributesDataProvider()
Definition: HtmlParserTest.php:611
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\parseConfigAndCleanHtml
‪string parseConfigAndCleanHtml(array $tsConfig, string $content)
Definition: HtmlParserTest.php:430
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\localNestingCorrectlyRemovesInvalidTagsDataProvider
‪static array localNestingCorrectlyRemovesInvalidTagsDataProvider()
Definition: HtmlParserTest.php:218
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\getFirstTagDataProvider
‪array getFirstTagDataProvider()
Definition: HtmlParserTest.php:441
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\removeFirstAndLastTagDataProvider
‪array removeFirstAndLastTagDataProvider()
Definition: HtmlParserTest.php:556
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\rmTagIfNoAttribIsConfiguredDoesNotChangeNestingType
‪rmTagIfNoAttribIsConfiguredDoesNotChangeNestingType()
Definition: HtmlParserTest.php:201
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\rawStripEmptyTagsTest
‪rawStripEmptyTagsTest(string $content, string $tagList, bool $treatNonBreakingSpaceAsEmpty, string $expectedResult)
Definition: HtmlParserTest.php:702
‪TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\splitIntoBlockDataProvider
‪array splitIntoBlockDataProvider()
Definition: HtmlParserTest.php:68