Completed
Push — master ( 55fdf1...0c48af )
by Johannes
02:35
created

EnvironmentFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testCreateService() 0 13 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\CommonMark;
11
12
use PHPUnit\Framework\TestCase;
13
use Jolicht\MarkdownCms\CommonMark\EnvironmentFactory;
14
use Interop\Container\ContainerInterface;
15
use League\CommonMark\Environment;
16
use League\CommonMark\Inline\Element\Image;
17
use Jolicht\MarkdownCms\Markdown\Renderer\ImageRenderer;
18
19
class EnvironmentFactoryTest extends TestCase
20
{
21
22
    private $factory;
23
24
    protected function setUp()
25
    {
26
        $this->factory = new EnvironmentFactory();
27
    }
28
29
    public function testCreateService()
30
    {
31
        $container = $this->prophesize(ContainerInterface::class);
32
33
        $imageRenderer = $this->prophesize(ImageRenderer::class);
34
        $container
35
            ->get(ImageRenderer::class)
36
            ->willReturn($imageRenderer->reveal());
37
38
        $environment = $this->factory->__invoke($container->reveal());
39
        $this->assertInstanceOf(Environment::class, $environment);
40
        $this->assertInstanceOf(ImageRenderer::class, $environment->getInlineRendererForClass(Image::class));
41
    }
42
}