Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/cebe/markdown/tests/ |
Upload File : |
<?php /** * @copyright Copyright (c) 2014 Carsten Brandt * @license https://github.com/cebe/markdown/blob/master/LICENSE * @link https://github.com/cebe/markdown#readme */ namespace cebe\markdown\tests; use cebe\markdown\GithubMarkdown; /** * Test case for the github flavored markdown. * * @author Carsten Brandt <mail@cebe.cc> * @group github */ class GithubMarkdownTest extends BaseMarkdownTest { public function createMarkdown() { return new GithubMarkdown(); } public function getDataPaths() { return [ 'markdown-data' => __DIR__ . '/markdown-data', 'github-data' => __DIR__ . '/github-data', ]; } public function testNewlines() { $markdown = $this->createMarkdown(); $this->assertEquals("This is text<br />\nnewline\nnewline.", $markdown->parseParagraph("This is text \nnewline\nnewline.")); $markdown->enableNewlines = true; $this->assertEquals("This is text<br />\nnewline<br />\nnewline.", $markdown->parseParagraph("This is text \nnewline\nnewline.")); $this->assertEquals("<p>This is text</p>\n<p>newline<br />\nnewline.</p>\n", $markdown->parse("This is text\n\nnewline\nnewline.")); } public function dataFiles() { $files = parent::dataFiles(); foreach($files as $i => $f) { // skip files that are different in github MD if ($f[0] === 'markdown-data' && ( $f[1] === 'list-marker-in-paragraph' || $f[1] === 'dense-block-markers' )) { unset($files[$i]); } } return $files; } public function testKeepZeroAlive() { $parser = $this->createMarkdown(); $this->assertEquals("0", $parser->parseParagraph("0")); $this->assertEquals("<p>0</p>\n", $parser->parse("0")); } public function testAutoLinkLabelingWithEncodedUrl() { $parser = $this->createMarkdown(); $utfText = "\xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\xe3\x81\x8a"; $utfNaturalUrl = "http://example.com/" . $utfText; $utfEncodedUrl = "http://example.com/" . urlencode($utfText); $eucEncodedUrl = "http://example.com/" . urlencode(mb_convert_encoding($utfText, 'EUC-JP', 'UTF-8')); $this->assertStringEndsWith(">{$utfNaturalUrl}</a>", $parser->parseParagraph($utfNaturalUrl), "Natural UTF-8 URL needs no conversion."); $this->assertStringEndsWith(">{$utfNaturalUrl}</a>", $parser->parseParagraph($utfEncodedUrl), "Encoded UTF-8 URL will be converted to readable format."); $this->assertStringEndsWith(">{$eucEncodedUrl}</a>", $parser->parseParagraph($eucEncodedUrl), "Non UTF-8 URL should never be converted."); // See: \cebe\markdown\inline\UrlLinkTrait::renderAutoUrl } }