]> git.mxchange.org Git - friendica.git/commitdiff
Add test for extraneous HTML decode removed in Markdown::toBBCode
authorHypolite Petovan <hypolite@mrpetovan.com>
Wed, 11 Mar 2020 13:02:26 +0000 (09:02 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 11 Mar 2020 13:02:26 +0000 (09:02 -0400)
tests/src/Content/Text/MarkdownTest.php

index a22c2e25bb5361e2926518b9f70a93afc1e3978f..e98b15bdf6ed8080eb4a59e6dda17e3533b91920 100644 (file)
@@ -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 <sup> and </sup> tag',
+                               'markdown' => 'with the &lt;sup&gt; and &lt;/sup&gt; 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);
+       }
 }