Completed
Push — master ( 2d5ed5...57ba8c )
by Daniel
12s
created

Container   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A loadTwig() 0 16 1
1
<?php
2
3
namespace Psi\Bridge\ContentType\Twig\Tests\Functional;
4
5
use Psi\Bridge\ContentType\Twig\ContentTypeExtension;
6
use Psi\Bridge\ContentType\Twig\TwigRenderer;
7
use Psi\Component\ContentType\Tests\Functional\Container as BaseContainer;
8
9
class Container extends BaseContainer
10
{
11
    public function __construct(array $config)
12
    {
13
        parent::__construct(array_merge([
14
            'mapping' => [],
15
            'db_path' => __DIR__ . '/../../../../cache/test.sqlite',
16
        ], $config));
17
18
        $this->loadTwig();
19
    }
20
21
    private function loadTwig()
22
    {
23
        $this['psi_content_type.view.twig.renderer'] = function ($container) {
24
            return new TwigRenderer($container['twig']);
25
        };
26
        $this['twig'] = function () {
27
            $twig = new \Twig_Environment(new \Twig_Loader_Filesystem(__DIR__ . '/../../templates'), [
28
                'debug' => true,
29
                'strict_variables' => true,
30
            ]);
31
32
            return $twig;
33
        };
34
35
        $this['twig']->addExtension(new ContentTypeExtension($this['psi_content_type.view.twig.renderer']));
36
    }
37
}
38