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