Added test for BBCode to Markdown chevron issue
- See https://github.com/friendica/friendica/issues/7808 Add tests
This commit is contained in:
parent
aa3a85c727
commit
39a537c415
1 changed files with 47 additions and 0 deletions
|
@ -203,6 +203,18 @@ class BBCodeTest extends MockedTest
|
||||||
'text' => '[audio]http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3[/audio]',
|
'text' => '[audio]http://www.cendrones.fr/colloque2017/jonathanbocquet.mp3[/audio]',
|
||||||
'try_oembed' => true,
|
'try_oembed' => true,
|
||||||
],
|
],
|
||||||
|
'bug-7808-code-lt' => [
|
||||||
|
'expectedHtml' => '<code><</code>',
|
||||||
|
'text' => '[code]<[/code]',
|
||||||
|
],
|
||||||
|
'bug-7808-code-gt' => [
|
||||||
|
'expectedHtml' => '<code>></code>',
|
||||||
|
'text' => '[code]>[/code]',
|
||||||
|
],
|
||||||
|
'bug-7808-code-amp' => [
|
||||||
|
'expectedHtml' => '<code>&</code>',
|
||||||
|
'text' => '[code]&[/code]',
|
||||||
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,4 +236,39 @@ class BBCodeTest extends MockedTest
|
||||||
|
|
||||||
$this->assertEquals($expectedHtml, $actual);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue