diff --git a/tests/datasets/content/text/html/bug-7457.html b/tests/datasets/content/text/html/bug-7457.html new file mode 100644 index 0000000000..4a2d4b33c7 --- /dev/null +++ b/tests/datasets/content/text/html/bug-7457.html @@ -0,0 +1 @@ +

[1.0.4] - 2019-08-01

Fixed

\ 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 index 0000000000..051071d557 --- /dev/null +++ b/tests/datasets/content/text/html/bug-7457.txt @@ -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 index 0000000000..65ae052498 --- /dev/null +++ b/tests/src/Content/Text/HTMLTest.php @@ -0,0 +1,53 @@ +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); + } +} diff --git a/tests/src/Content/Text/MarkdownTest.php b/tests/src/Content/Text/MarkdownTest.php index e39b46b2c5..80421b5221 100644 --- a/tests/src/Content/Text/MarkdownTest.php +++ b/tests/src/Content/Text/MarkdownTest.php @@ -1,52 +1,52 @@ -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); - } -} \ No newline at end of file +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); + } +}