3 namespace Friendica\Test\src\Content\Text;
\r
5 use Friendica\Content\Text\Markdown;
\r
6 use Friendica\Test\MockedTest;
\r
7 use Friendica\Test\Util\AppMockTrait;
\r
8 use Friendica\Test\Util\VFSTrait;
\r
10 class MarkdownTest extends MockedTest
\r
15 protected function setUp()
\r
18 $this->setUpVfsDir();
\r
19 $this->mockApp($this->root);
\r
22 public function dataMarkdown()
\r
24 $inputFiles = glob(__DIR__ . '/../../../datasets/content/text/markdown/*.md');
\r
28 foreach ($inputFiles as $file) {
\r
29 $data[str_replace('.md', '', $file)] = [
\r
30 'input' => file_get_contents($file),
\r
31 'expected' => file_get_contents(str_replace('.md', '.html', $file))
\r
39 * Test convert different input Markdown text into HTML
\r
40 * @dataProvider dataMarkdown
\r
42 * @param string $input The Markdown text to test
\r
43 * @param string $expected The expected HTML output
\r
44 * @throws \Exception
\r
46 public function testConvert($input, $expected)
\r
48 $output = Markdown::convert($input);
\r
50 $this->assertEquals($expected, $output);
\r