404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.22.75.138: ~ $
<?php

declare(strict_types=1);

/*
 * This file is part of the league/commonmark package.
 *
 * (c) Colin O'Dell <colinodell@gmail.com>
 *
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
 *  - (c) John MacFarlane
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace League\CommonMark\Tests\Functional;

use League\CommonMark\CommonMarkConverter;
use League\CommonMark\MarkdownConverter;
use League\CommonMark\Util\SpecReader;
use PHPUnit\Framework\TestCase;

abstract class AbstractSpecTest extends TestCase
{
    protected MarkdownConverter $converter;

    protected function setUp(): void
    {
        $this->converter = new CommonMarkConverter();
    }

    /**
     * @dataProvider dataProvider
     *
     * @param string $markdown Markdown to parse
     * @param string $html     Expected result
     */
    public function testSpecExample(string $markdown, string $html): void
    {
        $actualResult = (string) $this->converter->convert($markdown);

        $failureMessage  = 'Unexpected result:';
        $failureMessage .= "\n=== markdown ===============\n" . $this->showSpaces($markdown);
        $failureMessage .= "\n=== expected ===============\n" . $this->showSpaces($html);
        $failureMessage .= "\n=== got ====================\n" . $this->showSpaces($actualResult);

        $this->assertEquals($html, $actualResult, $failureMessage);
    }

    public function dataProvider(): \Generator
    {
        yield from $this->loadSpecExamples();
    }

    protected function loadSpecExamples(): \Generator
    {
        yield from SpecReader::readFile($this->getFileName());
    }

    private function showSpaces(string $str): string
    {
        return \strtr($str, ["\t" => '→', ' ' => '␣']);
    }

    abstract protected function getFileName(): string;
}

Filemanager

Name Type Size Permission Actions
Delimiter Folder 0755
Extension Folder 0755
data Folder 0755
AbstractLocalDataTest.php File 3.01 KB 0644
AbstractSpecTest.php File 1.95 KB 0644
CMarkRegressionTest.php File 1.29 KB 0644
CommonMarkJSRegressionTest.php File 1.31 KB 0644
HtmlInputTest.php File 2.46 KB 0644
LocalDataTest.php File 1.02 KB 0644
MaximumNestingLevelTest.php File 1.3 KB 0644
SafeLinksTest.php File 1.46 KB 0644
SpecTest.php File 715 B 0644