From bcf974f97e5dbc3ea70b50992bae4254cbb66f27 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 11 Mar 2020 09:02:26 -0400 Subject: [PATCH] Add test for extraneous HTML decode removed in Markdown::toBBCode --- tests/src/Content/Text/MarkdownTest.php | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/src/Content/Text/MarkdownTest.php b/tests/src/Content/Text/MarkdownTest.php index a22c2e25bb..e98b15bdf6 100644 --- a/tests/src/Content/Text/MarkdownTest.php +++ b/tests/src/Content/Text/MarkdownTest.php @@ -21,6 +21,7 @@ namespace Friendica\Test\src\Content\Text; +use Friendica\Content\Text\HTML; use Friendica\Content\Text\Markdown; use Friendica\Test\MockedTest; use Friendica\Test\Util\AppMockTrait; @@ -68,4 +69,30 @@ class MarkdownTest extends MockedTest $this->assertEquals($expected, $output); } + + public function dataMarkdownText() + { + return [ + 'bug-8358-double-decode' => [ + 'expectedBBCode' => 'with the and tag', + 'markdown' => 'with the <sup> and </sup> tag', + ], + ]; + } + + /** + * Test convert Markdown to BBCode + * + * @dataProvider dataMarkdownText + * + * @param string $expectedBBCode Expected BBCode output + * @param string $html Markdown text + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public function testToBBCode($expectedBBCode, $html) + { + $actual = Markdown::toBBCode($html); + + $this->assertEquals($expectedBBCode, $actual); + } } -- 2.39.5