--- /dev/null
+<?php
+
+namespace Friendica\Test\src\Content\Text;
+
+use Friendica\Content\Text\HTML;
+use Friendica\Test\MockedTest;
+use Friendica\Test\Util\AppMockTrait;
+use Friendica\Test\Util\VFSTrait;
+
+class HTMLTest extends MockedTest
+{
+ use VFSTrait;
+ use AppMockTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->setUpVfsDir();
+ $this->mockApp($this->root);
+ }
+
+ public function dataHTML()
+ {
+ $inputFiles = glob(__DIR__ . '/../../../datasets/content/text/html/*.html');
+
+ $data = [];
+
+ foreach ($inputFiles as $file) {
+ $data[str_replace('.html', '', $file)] = [
+ 'input' => file_get_contents($file),
+ 'expected' => file_get_contents(str_replace('.html', '.txt', $file))
+ ];
+ }
+
+ return $data;
+ }
+
+ /**
+ * Test convert different input Markdown text into HTML
+ *
+ * @dataProvider dataHTML
+ *
+ * @param string $input The Markdown text to test
+ * @param string $expected The expected HTML output
+ * @throws \Exception
+ */
+ public function testToPlaintext($input, $expected)
+ {
+ $output = HTML::toPlaintext($input, 0);
+
+ $this->assertEquals($expected, $output);
+ }
+}
-<?php\r
-\r
-namespace Friendica\Test\src\Content\Text;\r
-\r
-use Friendica\Content\Text\Markdown;\r
-use Friendica\Test\MockedTest;\r
-use Friendica\Test\Util\AppMockTrait;\r
-use Friendica\Test\Util\VFSTrait;\r
-\r
-class MarkdownTest extends MockedTest\r
-{\r
- use VFSTrait;\r
- use AppMockTrait;\r
-\r
- protected function setUp()\r
- {\r
- parent::setUp();\r
- $this->setUpVfsDir();\r
- $this->mockApp($this->root);\r
- }\r
-\r
- public function dataMarkdown()\r
- {\r
- $inputFiles = glob(__DIR__ . '/../../../datasets/content/text/markdown/*.md');\r
-\r
- $data = [];\r
-\r
- foreach ($inputFiles as $file) {\r
- $data[str_replace('.md', '', $file)] = [\r
- 'input' => file_get_contents($file),\r
- 'expected' => file_get_contents(str_replace('.md', '.html', $file))\r
- ];\r
- }\r
-\r
- return $data;\r
- }\r
-\r
- /**\r
- * Test convert different input Markdown text into HTML\r
- * @dataProvider dataMarkdown\r
- *\r
- * @param string $input The Markdown text to test\r
- * @param string $expected The expected HTML output\r
- * @throws \Exception\r
- */\r
- public function testConvert($input, $expected)\r
- {\r
- $output = Markdown::convert($input);\r
-\r
- $this->assertEquals($expected, $output);\r
- }\r
-}
\ No newline at end of file
+<?php
+
+namespace Friendica\Test\src\Content\Text;
+
+use Friendica\Content\Text\Markdown;
+use Friendica\Test\MockedTest;
+use Friendica\Test\Util\AppMockTrait;
+use Friendica\Test\Util\VFSTrait;
+
+class MarkdownTest extends MockedTest
+{
+ use VFSTrait;
+ use AppMockTrait;
+
+ protected function setUp()
+ {
+ parent::setUp();
+ $this->setUpVfsDir();
+ $this->mockApp($this->root);
+ }
+
+ public function dataMarkdown()
+ {
+ $inputFiles = glob(__DIR__ . '/../../../datasets/content/text/markdown/*.md');
+
+ $data = [];
+
+ foreach ($inputFiles as $file) {
+ $data[str_replace('.md', '', $file)] = [
+ 'input' => file_get_contents($file),
+ 'expected' => file_get_contents(str_replace('.md', '.html', $file))
+ ];
+ }
+
+ return $data;
+ }
+
+ /**
+ * Test convert different input Markdown text into HTML
+ * @dataProvider dataMarkdown
+ *
+ * @param string $input The Markdown text to test
+ * @param string $expected The expected HTML output
+ * @throws \Exception
+ */
+ public function testConvert($input, $expected)
+ {
+ $output = Markdown::convert($input);
+
+ $this->assertEquals($expected, $output);
+ }
+}