Completed
Push — master ( 4534a2...4c3ec3 )
by Johannes
03:54
created

FrontYamlParserFactoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A testContainerHasService() 0 4 1
A testInvoke() 0 9 1
1
<?php
2
/**
3
 * Lichtenwallner  (https://lichtenwallner.at)
4
 *
5
 * @see https://github.com/jolicht/markdown-cms for the canonical source repository
6
 * @license https://github.com/jolicht/markdown-cms/blob/master/LICENSE MIT
7
 * @copyright Copyright (c) Johannes Lichtenwallner
8
 */
9
declare(strict_types = 1);
10
namespace JolichtTest\MarkdownCms\Markdown;
11
12
use Reddogs\Test\ServiceManagerAwareTestCase;
13
use Jolicht\MarkdownCms\ModuleConfig;
14
use Jolicht\MarkdownCms\Markdown\FrontYamlParserFactory;
15
use Mni\FrontYAML\Parser;
16
use Mni\FrontYAML\Bridge\CommonMark\CommonMarkParser;
17
18
class FrontYamlParserFactoryTest extends ServiceManagerAwareTestCase
19
{
20
    private $factory;
21
22
    protected function setUp()
23
    {
24
        $this->setConfigProviders([
25
            ModuleConfig::class
26
        ]);
27
        parent::setUp();
28
        $this->factory = new FrontYamlParserFactory();
29
    }
30
31
    public function testContainerHasService()
32
    {
33
        $this->assertTrue($this->getContainer()->has(Parser::class));
34
    }
35
36
    public function testInvoke()
37
    {
38
        $frontYaml = $this->factory->__invoke($this->getContainer(), Parser::class);
39
        $this->assertInstanceOf(Parser::class, $frontYaml);
40
        $reflectionObject = new \ReflectionObject($frontYaml);
41
        $reflectionProperty = $reflectionObject->getProperty('markdownParser');
42
        $reflectionProperty->setAccessible(true);
43
        $this->assertInstanceOf(CommonMarkParser::class, $reflectionProperty->getValue($frontYaml));
44
    }
45
}