summaryrefslogtreecommitdiff
path: root/vendor/parsedown-0.9.0/tests/Test.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/parsedown-0.9.0/tests/Test.php')
-rw-r--r--vendor/parsedown-0.9.0/tests/Test.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/vendor/parsedown-0.9.0/tests/Test.php b/vendor/parsedown-0.9.0/tests/Test.php
new file mode 100644
index 00000000..e38974ce
--- /dev/null
+++ b/vendor/parsedown-0.9.0/tests/Test.php
@@ -0,0 +1,55 @@
+<?php
+
+include 'Parsedown.php';
+
+class Test extends PHPUnit_Framework_TestCase
+{
+ const provider_dir = 'data/';
+
+ /**
+ * @dataProvider provider
+ */
+ function test_($markdown, $expected_markup)
+ {
+ $actual_markup = Parsedown::instance()->parse($markdown);
+
+ $this->assertEquals($expected_markup, $actual_markup);
+ }
+
+ function provider()
+ {
+ $provider = array();
+
+ $path = dirname(__FILE__).'/';
+
+ $DirectoryIterator = new DirectoryIterator($path . '/' . self::provider_dir);
+
+ foreach ($DirectoryIterator as $Item)
+ {
+ if ($Item->isFile())
+ {
+ $filename = $Item->getFilename();
+
+ $extension = pathinfo($filename, PATHINFO_EXTENSION);
+
+ if ($extension !== 'md')
+ continue;
+
+ $basename = $Item->getBasename('.md');
+
+ $markdown = file_get_contents($path . '/' . self::provider_dir . $basename . '.md');
+
+ if (!$markdown)
+ continue;
+
+ $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", $expected_markup);
+
+ $provider [] = array($markdown, $expected_markup);
+ }
+ }
+
+ return $provider;
+ }
+} \ No newline at end of file