Completed
Push — master ( c6cf43...d97653 )
by Martin
03:30 queued 15s
created

FrontMatterLeagueCommonMarkExtensionTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This is part of the webuni/front-matter package.
5
 *
6
 * (c) Martin Hasoň <[email protected]>
7
 * (c) Webuni s.r.o. <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Webuni\FrontMatter\Tests\Markdown;
14
15
use League\CommonMark\CommonMarkConverter;
16
use League\CommonMark\Environment;
17
use PHPUnit\Framework\TestCase;
18
use Webuni\FrontMatter\FrontMatter;
19
use Webuni\FrontMatter\Markdown\FrontMatterLeagueCommonMarkExtension;
20
21
class FrontMatterLeagueCommonMarkExtensionTest extends TestCase
22
{
23
    private $environment;
24
25
    protected function setUp(): void
26
    {
27
        $this->environment = $environment = Environment::createCommonMarkEnvironment();
28
        $environment->addExtension(new FrontMatterLeagueCommonMarkExtension(FrontMatter::createYaml()));
29
    }
30
31
    public function testConvert()
32
    {
33
        $converter = new CommonMarkConverter([], $this->environment);
34
        $this->assertEquals("<h1>Head</h1>\n", $converter->convertToHtml("---\nfoo: bar\n---\nHead\n====\n"));
35
    }
36
}
37