%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/egp/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\Markdown;
/**
* Test case for traditional markdown.
*
* @author Carsten Brandt <mail@cebe.cc>
* @group default
*/
class MarkdownTest extends BaseMarkdownTest
{
public function createMarkdown()
{
return new Markdown();
}
public function getDataPaths()
{
return [
'markdown-data' => __DIR__ . '/markdown-data',
];
}
public function testEdgeCases()
{
$this->assertEquals("<p>&</p>\n", $this->createMarkdown()->parse('&'));
$this->assertEquals("<p><</p>\n", $this->createMarkdown()->parse('<'));
}
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\LinkTrait::renderUrl
}
}