]> git.mxchange.org Git - friendica.git/commitdiff
Add test case for this bug
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 4 Aug 2019 14:24:25 +0000 (10:24 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Sun, 4 Aug 2019 14:24:25 +0000 (10:24 -0400)
- Fix whitespaces in MarkdownTest

tests/datasets/content/text/html/bug-7457.html [new file with mode: 0644]
tests/datasets/content/text/html/bug-7457.txt [new file with mode: 0644]
tests/src/Content/Text/HTMLTest.php [new file with mode: 0644]
tests/src/Content/Text/MarkdownTest.php

diff --git a/tests/datasets/content/text/html/bug-7457.html b/tests/datasets/content/text/html/bug-7457.html
new file mode 100644 (file)
index 0000000..4a2d4b3
--- /dev/null
@@ -0,0 +1 @@
+<h2 data-sourcepos="1:1-1:23" dir="auto">&#x000A;<a id="user-content-104-2019-08-01" class="anchor" href="#104-2019-08-01" aria-hidden="true"></a>[1.0.4] - 2019-08-01</h2>&#x000A;<h3 data-sourcepos="2:1-2:9" dir="auto">&#x000A;<a id="user-content-fixed" class="anchor" href="#fixed" aria-hidden="true"></a>Fixed</h3>&#x000A;<ul data-sourcepos="3:1-3:116" dir="auto">&#x000A;<li data-sourcepos="3:1-3:116">Invalid SemVer version generation, when the current branch does not have commits ahead of tag/checked out on a tag</li>&#x000A;</ul>
\ No newline at end of file
diff --git a/tests/datasets/content/text/html/bug-7457.txt b/tests/datasets/content/text/html/bug-7457.txt
new file mode 100644 (file)
index 0000000..051071d
--- /dev/null
@@ -0,0 +1,5 @@
+*[1.0.4] - 2019-08-01*
+
+*Fixed*
+
+* Invalid SemVer version generation, when the current branch does not have commits ahead of tag/checked out on a tag
\ No newline at end of file
diff --git a/tests/src/Content/Text/HTMLTest.php b/tests/src/Content/Text/HTMLTest.php
new file mode 100644 (file)
index 0000000..65ae052
--- /dev/null
@@ -0,0 +1,53 @@
+<?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);
+       }
+}
index e39b46b2c567be565e58bf4e1fc7c548010cb4d9..80421b5221832289f7624a4b744bed991cd2301e 100644 (file)
@@ -1,52 +1,52 @@
-<?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);
+       }
+}