From 77256a0864f38772ab869e5ef12530db0a43fa2c Mon Sep 17 00:00:00 2001 From: Michael Oehlhof Date: Sun, 23 Aug 2015 10:15:42 +0200 Subject: [PATCH] [TASK] Add unit tests for HtmlParser->removeFirstAndLastTag() Resolves: #69266 Releases: master Change-Id: I8c35c1c175e632d2cba9fb6a495daf09486dc290 Reviewed-on: http://review.typo3.org/42844 Reviewed-by: Alexander Opitz Tested-by: Alexander Opitz Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters --- .../core/Tests/Unit/Html/HtmlParserTest.php | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/typo3/sysext/core/Tests/Unit/Html/HtmlParserTest.php b/typo3/sysext/core/Tests/Unit/Html/HtmlParserTest.php index 739ab4e48c20..03005cb335e6 100644 --- a/typo3/sysext/core/Tests/Unit/Html/HtmlParserTest.php +++ b/typo3/sysext/core/Tests/Unit/Html/HtmlParserTest.php @@ -826,4 +826,30 @@ Value 2.2 $config = $this->subject->HTMLparserConfig($tsConfig); return $this->subject->HTMLcleaner($content, $config[0], $config[1], $config[2], $config[3]); } + + /** + * @return array + */ + public function removeFirstAndLastTagDataProvider() { + return array( + array('Wrapper
Some content
', 'Wrapper
Some content
'), + array('Some content', 'Some content'), + array('Something beforeWrapper
Some content
Something after', 'Wrapper
Some content
'), + array('', 'Wrapper
Some content
'), + array('Wrapper', 'Wrapper'), + ); + } + + /** + * Removes the first and last tag in the string + * Anything before the first and after the last tags respectively is also removed + * + * @test + * @dataProvider removeFirstAndLastTagDataProvider + * @param string $str String to process + * @param string $expectedResult + */ + public function removeFirstAndLastTag($str, $expectedResult) { + $this->assertEquals($expectedResult, $this->subject->removeFirstAndLastTag($str)); + } } -- 2.20.1