Completed
Pull Request — master (#47)
by Marko
62:01
created

TwigTemplateTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 38
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Ivory CKEditor package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\CKEditorBundle\Tests\Template;
13
14
use Ivory\CKEditorBundle\Twig\CKEditorExtension;
15
16
/**
17
 * @author GeLo <[email protected]>
18
 */
19
class TwigTemplateTest extends AbstractTemplateTest
20
{
21
    /**
22
     * @var \Twig\Environment
23
     */
24
    private $twig;
25
26
    /**
27
     * @var \Twig\Template
28
     */
29
    private $template;
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function setUp()
35
    {
36
        parent::setUp();
37
38
        $symfonyTheme = '{% block widget_attributes %}{% endblock %}';
39
        $ckeditorTheme = file_get_contents(__DIR__.'/../../src/Resources/views/Form/ckeditor_widget.html.twig');
40
41
        $this->twig = new \Twig_Environment(new \Twig_Loader_Array([
42
            'ckeditor' => $symfonyTheme.$ckeditorTheme,
43
        ]));
44
45
        $this->twig->addExtension(new CKEditorExtension($this->renderer));
46
        $this->template = $this->twig->loadTemplate('ckeditor');
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    protected function renderTemplate(array $context = [])
53
    {
54
        return $this->template->renderBlock('ckeditor_widget', $context);
55
    }
56
}
57