1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00
parsedown/tests/Test.php

46 lines
943 B
PHP
Raw Normal View History

2013-07-22 00:14:30 +04:00
<?php
include 'Parsedown.php';
class Test extends PHPUnit_Framework_TestCase
{
const provider_dir = 'data/';
/**
* @dataProvider provider
*/
2013-07-22 01:10:01 +04:00
public function test_($markdown, $expected)
2013-07-22 00:14:30 +04:00
{
2013-07-22 01:10:01 +04:00
$actual = Parsedown::instance()->parse($markdown);
2013-07-22 00:14:30 +04:00
$this->assertEquals($expected, $actual);
}
public function provider()
{
$provider = array();
$DirectoryIterator = new DirectoryIterator(__DIR__.'/'.self::provider_dir);
foreach ($DirectoryIterator as $Item)
{
if ($Item->isFile() and $Item->getExtension() === 'md')
{
$basename = $Item->getBasename('.md');
$markdown = file_get_contents(__DIR__.'/'.self::provider_dir.$basename.'.md');
if ( ! $markdown)
continue;
$expected_markup = file_get_contents(__DIR__.'/'.self::provider_dir.$basename.'.html');
2013-07-22 01:10:01 +04:00
$provider []= array($markdown, $expected_markup);
2013-07-22 00:14:30 +04:00
}
}
return $provider;
}
}