Add test for extraneous HTML decode removed in Markdown::toBBCode

This commit is contained in:
Hypolite Petovan 2020-03-11 09:02:26 -04:00
parent 5c726493ae
commit bcf974f97e
1 changed files with 27 additions and 0 deletions

View 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);
}
}