diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-05-29 20:44:28 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-05-29 20:44:28 -0400 |
commit | a3dfdd9d3886451f5e97940387a56171c5810cf6 (patch) | |
tree | 9c68b25867f19d440e6b3aab67e6636f5ceb6734 /library/parsedown/test/CommonMarkTest.php | |
parent | 00d32f6b947d10b836cf1a4d59dbff3413517fd5 (diff) | |
download | volse-hubzilla-a3dfdd9d3886451f5e97940387a56171c5810cf6.tar.gz volse-hubzilla-a3dfdd9d3886451f5e97940387a56171c5810cf6.tar.bz2 volse-hubzilla-a3dfdd9d3886451f5e97940387a56171c5810cf6.zip |
Remove Parsedown library files and remove references.
Diffstat (limited to 'library/parsedown/test/CommonMarkTest.php')
-rw-r--r-- | library/parsedown/test/CommonMarkTest.php | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/library/parsedown/test/CommonMarkTest.php b/library/parsedown/test/CommonMarkTest.php deleted file mode 100644 index 9b8d11620..000000000 --- a/library/parsedown/test/CommonMarkTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -/** - * Test Parsedown against the CommonMark spec. - * - * Some code based on the original JavaScript test runner by jgm. - * - * @link http://commonmark.org/ CommonMark - * @link http://git.io/8WtRvQ JavaScript test runner - */ -class CommonMarkTest extends PHPUnit_Framework_TestCase -{ - const SPEC_URL = 'https://raw.githubusercontent.com/jgm/stmd/master/spec.txt'; - - /** - * @dataProvider data - * @param $section - * @param $markdown - * @param $expectedHtml - */ - function test_($section, $markdown, $expectedHtml) - { - $Parsedown = new Parsedown(); - $Parsedown->setUrlsLinked(false); - - $actualHtml = $Parsedown->text($markdown); - $actualHtml = $this->normalizeMarkup($actualHtml); - - $this->assertEquals($expectedHtml, $actualHtml); - } - - function data() - { - $spec = file_get_contents(self::SPEC_URL); - $spec = strstr($spec, '<!-- END TESTS -->', true); - - $tests = array(); - $currentSection = ''; - - preg_replace_callback( - '/^\.\n([\s\S]*?)^\.\n([\s\S]*?)^\.$|^#{1,6} *(.*)$/m', - function($matches) use ( & $tests, & $currentSection, & $testCount) { - if (isset($matches[3]) and $matches[3]) { - $currentSection = $matches[3]; - } else { - $testCount++; - $markdown = $matches[1]; - $markdown = preg_replace('/→/', "\t", $markdown); - $expectedHtml = $matches[2]; - $expectedHtml = $this->normalizeMarkup($expectedHtml); - $tests []= array( - $currentSection, # section - $markdown, # markdown - $expectedHtml, # html - ); - } - }, - $spec - ); - - return $tests; - } - - private function normalizeMarkup($markup) - { - $markup = preg_replace("/\n+/", "\n", $markup); - $markup = preg_replace('/^\s+/m', '', $markup); - $markup = preg_replace('/^((?:<[\w]+>)+)\n/m', '$1', $markup); - $markup = preg_replace('/\n((?:<\/[\w]+>)+)$/m', '$1', $markup); - $markup = trim($markup); - - return $markup; - } -} |