File: LocalDataTest.php

package info (click to toggle)
php-league-commonmark 1.5.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,284 kB
  • sloc: php: 16,992; makefile: 24; ruby: 21; javascript: 15; sh: 9
file content (77 lines) | stat: -rw-r--r-- 2,156 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php

/*
 * This file is part of the league/commonmark package.
 *
 * (c) Colin O'Dell <colinodell@gmail.com>
 * (c) Rezo Zero / Ambroise Maupate
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace League\CommonMark\Tests\Functional\Extension\Footnote;

use League\CommonMark\CommonMarkConverter;
use League\CommonMark\Environment;
use League\CommonMark\Extension\Footnote\FootnoteExtension;
use League\CommonMark\Tests\Functional\AbstractLocalDataTest;

/**
 * @internal
 */
final class LocalDataTest extends AbstractLocalDataTest
{
    /** @var CommonMarkConverter */
    private $commonMarkConverter;

    /** @var CommonMarkConverter */
    private $gfmConverter;

    protected function setUp(): void
    {
        /*
         * Test with minimal extensions
         */
        $environment = Environment::createCommonMarkEnvironment();
        $environment->addExtension(new FootnoteExtension());
        $this->commonMarkConverter = new CommonMarkConverter([], $environment);

        /*
         * Test with other extensions
         */
        $gfmEnvironment = Environment::createGFMEnvironment();
        $gfmEnvironment->addExtension(new FootnoteExtension());
        $this->gfmConverter = new CommonMarkConverter([], $gfmEnvironment);
    }

    /**
     * @dataProvider dataProvider
     */
    public function testRenderer(string $markdown, string $html, string $testName): void
    {
        $this->converter = $this->commonMarkConverter;
        $this->assertMarkdownRendersAs($markdown, $html, $testName);
    }

    /**
     * @dataProvider dataProvider
     */
    public function testExtraRenderer(string $markdown, string $html, string $testName): void
    {
        $this->converter = $this->gfmConverter;
        $this->assertMarkdownRendersAs($markdown, $html, $testName);
    }

    /**
     * @return iterable<string, string, string>
     */
    public function dataProvider(): iterable
    {
        foreach ($this->loadTests(__DIR__ . '/data', '*.md') as $test) {
            yield $test;
        }
    }
}