diff --git a/tests/src/Content/Text/BBCodeTest.php b/tests/src/Content/Text/BBCodeTest.php
index 1ff653db91..ed33306edf 100644
--- a/tests/src/Content/Text/BBCodeTest.php
+++ b/tests/src/Content/Text/BBCodeTest.php
@@ -203,6 +203,18 @@ class BBCodeTest extends MockedTest
'text' => '[audio]http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3[/audio]',
'try_oembed' => true,
],
+ 'bug-7808-code-lt' => [
+ 'expectedHtml' => '<
',
+ 'text' => '[code]<[/code]',
+ ],
+ 'bug-7808-code-gt' => [
+ 'expectedHtml' => '>
',
+ 'text' => '[code]>[/code]',
+ ],
+ 'bug-7808-code-amp' => [
+ 'expectedHtml' => '&
',
+ 'text' => '[code]&[/code]',
+ ]
];
}
@@ -224,4 +236,39 @@ class BBCodeTest extends MockedTest
$this->assertEquals($expectedHtml, $actual);
}
+
+ public function dataBBCodesToMarkdown()
+ {
+ return [
+ 'bug-7808-gt' => [
+ 'expected' => '>`>`',
+ 'text' => '>[code]>[/code]',
+ ],
+ 'bug-7808-lt' => [
+ 'expected' => '<`<`',
+ 'text' => '<[code]<[/code]',
+ ],
+ 'bug-7808-amp' => [
+ 'expected' => '&`&`',
+ 'text' => '&[code]&[/code]',
+ ],
+ ];
+ }
+
+ /**
+ * Test convert bbcodes to Markdown
+ *
+ * @dataProvider dataBBCodesToMarkdown
+ *
+ * @param string $expected Expected Markdown output
+ * @param string $text BBCode text
+ * @param bool $for_diaspora
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
+ */
+ public function testToMarkdown($expected, $text, $for_diaspora = false)
+ {
+ $actual = BBCode::toMarkdown($text, $for_diaspora);
+
+ $this->assertEquals($expected, $actual);
+ }
}