Add test case for this bug

- Fix whitespaces in MarkdownTest
This commit is contained in:
Hypolite Petovan 2019-08-04 10:24:25 -04:00
parent 4a85de4c19
commit 515935b241
4 changed files with 111 additions and 52 deletions

View file

@ -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>

View file

@ -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

View file

@ -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);
}
}