mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add initState to tests
This commit is contained in:
parent
c773305bc1
commit
0f27f2e842
@ -39,6 +39,16 @@ class ParsedownTest extends TestCase
|
|||||||
return [\dirname(__FILE__).'/data/'];
|
return [\dirname(__FILE__).'/data/'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function initState(string $testName): State
|
||||||
|
{
|
||||||
|
return new State([
|
||||||
|
new SafeMode(\substr($testName, 0, 3) === 'xss'),
|
||||||
|
new StrictMode(\substr($testName, 0, 6) === 'strict'),
|
||||||
|
new Breaks(\substr($testName, 0, 14) === 'breaks_enabled'),
|
||||||
|
new HeaderSlug(\substr($testName, 0, 4) === 'slug'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider data
|
* @dataProvider data
|
||||||
* @param string $test
|
* @param string $test
|
||||||
@ -56,12 +66,7 @@ class ParsedownTest extends TestCase
|
|||||||
$expectedMarkup = \str_replace("\r\n", "\n", $expectedMarkup);
|
$expectedMarkup = \str_replace("\r\n", "\n", $expectedMarkup);
|
||||||
$expectedMarkup = \str_replace("\r", "\n", $expectedMarkup);
|
$expectedMarkup = \str_replace("\r", "\n", $expectedMarkup);
|
||||||
|
|
||||||
$Parsedown = new Parsedown(new State([
|
$Parsedown = new Parsedown($this->initState($test));
|
||||||
new SafeMode(\substr($test, 0, 3) === 'xss'),
|
|
||||||
new StrictMode(\substr($test, 0, 6) === 'strict'),
|
|
||||||
new Breaks(\substr($test, 0, 14) === 'breaks_enabled'),
|
|
||||||
new HeaderSlug(\substr($test, 0, 4) === 'slug'),
|
|
||||||
]));
|
|
||||||
|
|
||||||
$actualMarkup = $Parsedown->toHtml($markdown);
|
$actualMarkup = $Parsedown->toHtml($markdown);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user