Completed
Pull Request — master (#40)
by Marko
445:50 queued 380:43
created

TwigTemplateTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 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 FOS\CKEditorBundle\Tests\Template;
13
14
use FOS\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