summaryrefslogtreecommitdiff
path: root/vendor/parsedown-0.9.0/tests/Test.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-03-09 13:12:39 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-03-09 13:12:39 +0100
commit893bb5a9cf365c831e75fafc83dffdbced09a466 (patch)
treeef7a4f923ebb49a70697b0388af359b2b44b2109 /vendor/parsedown-0.9.0/tests/Test.php
parent82c0d2acc24a0b19de246c4f2c3d37a8e197d11e (diff)
added parsedown 0.9.0
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