TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest Class Reference
Inheritance diagram for TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest:
TYPO3\CMS\Core\Tests\UnitTestCase TYPO3\CMS\Core\Tests\BaseTestCase

Public Member Functions

 cDataWillRemainUnmodifiedDataProvider ()
 
 splitIntoBlockDataProvider ()
 
 splitIntoBlock ($tag, $content, $eliminateExtraEndTags, $expected)
 
 xHtmlCleaningDoesNotModifyCDATA ($source, $expected)
 
 tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured ($content, $expectedResult)
 
 rmTagIfNoAttribIsConfiguredDoesNotChangeNestingType ()
 
 localNestingCorrectlyRemovesInvalidTags ($content, $expectedResult)
 
 globalNestingCorrectlyRemovesInvalidTags ($content, $expectedResult)
 
 emptyTagsDataProvider ()
 
 stripEmptyTags ($stripOn, $tagList, $treatNonBreakingSpaceAsEmpty, $content, $expectedResult)
 
 getFirstTagDataProvider ()
 
 getFirstTag ($str, $expected)
 
 getFirstTagNameDataProvider ()
 
 getFirstTagName ($str, $preserveCase, $expected)
 
 removeFirstAndLastTagDataProvider ()
 
 removeFirstAndLastTag ($str, $expectedResult)
 

Static Public Member Functions

static spanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfiguredDataProvider ()
 
static localNestingCorrectlyRemovesInvalidTagsDataProvider ()
 
static globalNestingCorrectlyRemovesInvalidTagsDataProvider ()
 

Protected Member Functions

 setUp ()
 
 parseConfigAndCleanHtml (array $tsConfig, $content)
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Tests\UnitTestCase
 tearDown ()
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Tests\BaseTestCase
 getAccessibleMock ( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)
 
 getAccessibleMockForAbstractClass ( $originalClassName, array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true, $mockedMethods=[])
 
 buildAccessibleProxy ($className)
 
 callInaccessibleMethod ($object, $name)
 
 inject ($target, $name, $dependency)
 
 getUniqueId ($prefix='')
 

Protected Attributes

 $subject = null
 
- Protected Attributes inherited from TYPO3\CMS\Core\Tests\UnitTestCase
 $backupGlobalsBlacklist = ['TYPO3_LOADED_EXT']
 
 $testFilesToDelete = []
 
- Protected Attributes inherited from TYPO3\CMS\Core\Tests\BaseTestCase
 $backupGlobals = true
 
 $backupStaticAttributes = false
 

Detailed Description

Testcase for

Definition at line 22 of file HtmlParserTest.php.

Member Function Documentation

◆ cDataWillRemainUnmodifiedDataProvider()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::cDataWillRemainUnmodifiedDataProvider ( )
Returns
array

Definition at line 37 of file HtmlParserTest.php.

◆ emptyTagsDataProvider()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::emptyTagsDataProvider ( )
Returns
array

Definition at line 294 of file HtmlParserTest.php.

◆ getFirstTag()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::getFirstTag (   $str,
  $expected 
)

Returns the first tag in $str Actually everything from the beginning of the $str is returned, so you better make sure the tag is the first thing...

Test:
getFirstTagDataProvider
Parameters
string$strHTML string with tags
string$expectedThe expected result.

Definition at line 379 of file HtmlParserTest.php.

◆ getFirstTagDataProvider()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::getFirstTagDataProvider ( )

Data provider for getFirstTag

Returns
array

Definition at line 359 of file HtmlParserTest.php.

◆ getFirstTagName()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::getFirstTagName (   $str,
  $preserveCase,
  $expected 
)

Returns the NAME of the first tag in $str

Test:
getFirstTagNameDataProvider
Parameters
string$strHTML tag (The element name MUST be separated from the attributes by a space character! Just whitespace will not do)
bool$preserveCaseIf set, then the tag is NOT converted to uppercase by case is preserved.
string$expectedThe expected result.

Definition at line 423 of file HtmlParserTest.php.

◆ getFirstTagNameDataProvider()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::getFirstTagNameDataProvider ( )

Data provider for getFirstTagName

Returns
array

Definition at line 389 of file HtmlParserTest.php.

◆ globalNestingCorrectlyRemovesInvalidTags()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::globalNestingCorrectlyRemovesInvalidTags (   $content,
  $expectedResult 
)
Test:
globalNestingCorrectlyRemovesInvalidTagsDataProvider
Parameters
string$content
string$expectedResult

Definition at line 282 of file HtmlParserTest.php.

References TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\parseConfigAndCleanHtml().

◆ globalNestingCorrectlyRemovesInvalidTagsDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::globalNestingCorrectlyRemovesInvalidTagsDataProvider ( )
static

Data provider for globalNestingCorrectlyRemovesInvalidTags

Returns
array

Definition at line 250 of file HtmlParserTest.php.

◆ localNestingCorrectlyRemovesInvalidTags()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::localNestingCorrectlyRemovesInvalidTags (   $content,
  $expectedResult 
)
Test:
localNestingCorrectlyRemovesInvalidTagsDataProvider
Parameters
string$content
string$expectedResult

Definition at line 236 of file HtmlParserTest.php.

References TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\parseConfigAndCleanHtml().

◆ localNestingCorrectlyRemovesInvalidTagsDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::localNestingCorrectlyRemovesInvalidTagsDataProvider ( )
static

Data provider for localNestingCorrectlyRemovesInvalidTags

Returns
array

Definition at line 204 of file HtmlParserTest.php.

◆ parseConfigAndCleanHtml()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::parseConfigAndCleanHtml ( array  $tsConfig,
  $content 
)
protected

Calls HTMLparserConfig() and passes the generated config to the HTMLcleaner() method on the current subject.

Parameters
array$tsConfigThe TypoScript that should be used to generate the HTML parser config.
string$contentThe content that should be parsed by the HTMLcleaner.
Returns
string The parsed content.

Definition at line 348 of file HtmlParserTest.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\globalNestingCorrectlyRemovesInvalidTags(), TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\localNestingCorrectlyRemovesInvalidTags(), TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\rmTagIfNoAttribIsConfiguredDoesNotChangeNestingType(), TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\stripEmptyTags(), and TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured().

◆ removeFirstAndLastTag()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::removeFirstAndLastTag (   $str,
  $expectedResult 
)

Removes the first and last tag in the string Anything before the first and after the last tags respectively is also removed

Test:
removeFirstAndLastTagDataProvider
Parameters
string$strString to process
string$expectedResult

Definition at line 451 of file HtmlParserTest.php.

◆ removeFirstAndLastTagDataProvider()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::removeFirstAndLastTagDataProvider ( )
Returns
array

Definition at line 431 of file HtmlParserTest.php.

◆ rmTagIfNoAttribIsConfiguredDoesNotChangeNestingType()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::rmTagIfNoAttribIsConfiguredDoesNotChangeNestingType ( )

◆ setUp()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::setUp ( )
protected

Definition at line 29 of file HtmlParserTest.php.

◆ spanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfiguredDataProvider()

static TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::spanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfiguredDataProvider ( )
static

Data provider for spanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured

Definition at line 146 of file HtmlParserTest.php.

◆ splitIntoBlock()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::splitIntoBlock (   $tag,
  $content,
  $eliminateExtraEndTags,
  $expected 
)
Test:
Parameters
string$tagList of tags, comma separated.
string$contentHTML-content
bool$eliminateExtraEndTagsIf set, excessive end tags are ignored - you should probably set this in most cases.
array$expectedThe expected result splitIntoBlockDataProvider

Definition at line 126 of file HtmlParserTest.php.

◆ splitIntoBlockDataProvider()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::splitIntoBlockDataProvider ( )

Data provider for splitIntoBlock

Returns
array

Definition at line 64 of file HtmlParserTest.php.

◆ stripEmptyTags()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::stripEmptyTags (   $stripOn,
  $tagList,
  $treatNonBreakingSpaceAsEmpty,
  $content,
  $expectedResult 
)
Test:
emptyTagsDataProvider
Parameters
bool$stripOnTRUE if stripping should be activated.
string$tagListComma seperated list of tags that should be stripped.
bool$treatNonBreakingSpaceAsEmptyIf TRUE   will be considered empty.
string$contentThe HTML code that should be modified.
string$expectedResultThe expected HTML code result.

Definition at line 326 of file HtmlParserTest.php.

References TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\parseConfigAndCleanHtml().

◆ tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::tagCorrectlyRemovedWhenRmTagIfNoAttribIsConfigured (   $content,
  $expectedResult 
)
Test:
Parameters
string$content
string$expectedResultspanTagCorrectlyRemovedWhenRmTagIfNoAttribIsConfiguredDataProvider

Definition at line 170 of file HtmlParserTest.php.

References TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest\parseConfigAndCleanHtml().

◆ xHtmlCleaningDoesNotModifyCDATA()

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::xHtmlCleaningDoesNotModifyCDATA (   $source,
  $expected 
)
Test:
Parameters
string$source
string$expectedcDataWillRemainUnmodifiedDataProvider

Definition at line 137 of file HtmlParserTest.php.

Member Data Documentation

◆ $subject

TYPO3\CMS\Core\Tests\Unit\Html\HtmlParserTest::$subject = null
protected

Definition at line 27 of file HtmlParserTest.php.