mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
update test case to make it run on PHP 5.2
This commit is contained in:
parent
96bf75bd91
commit
d96f668c42
@ -5,7 +5,7 @@ include 'Parsedown.php';
|
|||||||
class Test extends PHPUnit_Framework_TestCase
|
class Test extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
const provider_dir = 'data/';
|
const provider_dir = 'data/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider provider
|
* @dataProvider provider
|
||||||
*/
|
*/
|
||||||
@ -15,33 +15,41 @@ class Test extends PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$this->assertEquals($expected_markup, $actual_markup);
|
$this->assertEquals($expected_markup, $actual_markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
function provider()
|
function provider()
|
||||||
{
|
{
|
||||||
$provider = array();
|
$provider = array();
|
||||||
|
|
||||||
$DirectoryIterator = new DirectoryIterator(__DIR__ . '/' . self::provider_dir);
|
$path = dirname(__FILE__).'/';
|
||||||
|
|
||||||
|
$DirectoryIterator = new DirectoryIterator($path . '/' . self::provider_dir);
|
||||||
|
|
||||||
foreach ($DirectoryIterator as $Item)
|
foreach ($DirectoryIterator as $Item)
|
||||||
{
|
{
|
||||||
if ($Item->isFile() and $Item->getExtension() === 'md')
|
if ($Item->isFile())
|
||||||
{
|
{
|
||||||
|
$filename = $Item->getFilename();
|
||||||
|
|
||||||
|
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
if ($extension !== 'md')
|
||||||
|
continue;
|
||||||
|
|
||||||
$basename = $Item->getBasename('.md');
|
$basename = $Item->getBasename('.md');
|
||||||
|
|
||||||
$markdown = file_get_contents(__DIR__ . '/' . self::provider_dir . $basename . '.md');
|
$markdown = file_get_contents($path . '/' . self::provider_dir . $basename . '.md');
|
||||||
|
|
||||||
if (!$markdown)
|
if (!$markdown)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$expected_markup = file_get_contents(__DIR__ . '/' . self::provider_dir . $basename . '.html');
|
$expected_markup = file_get_contents($path . '/' . self::provider_dir . $basename . '.html');
|
||||||
$expected_markup = str_replace("\r\n", "\n", $expected_markup);
|
$expected_markup = str_replace("\r\n", "\n", $expected_markup);
|
||||||
$expected_markup = str_replace("\r", "\n", $expected_markup);
|
$expected_markup = str_replace("\r", "\n", $expected_markup);
|
||||||
|
|
||||||
$provider [] = array($markdown, $expected_markup);
|
$provider [] = array($markdown, $expected_markup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $provider;
|
return $provider;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user