Completed
Pull Request — master (#47)
by Maximilian
392:42 queued 327:39
created

PhpTemplateTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 6
dl 0
loc 51
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\Templating\CKEditorHelper;
15
use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper;
16
use Symfony\Component\Templating\Helper\SlotsHelper;
17
use Symfony\Component\Templating\Loader\FilesystemLoader;
18
use Symfony\Component\Templating\PhpEngine;
19
use Symfony\Component\Templating\TemplateNameParser;
20
21
/**
22
 * @author GeLo <[email protected]>
23
 */
24
class PhpTemplateTest extends AbstractTemplateTest
25
{
26
    /**
27
     * @var PhpEngine
28
     */
29
    private $phpEngine;
30
31
    /**
32
     * @var FormHelper|\PHPUnit_Framework_MockObject_MockObject
33
     */
34
    private $formHelper;
35
36
    /**
37
     * @var SlotsHelper|\PHPUnit_Framework_MockObject_MockObject
38
     */
39
    private $slotsHelper;
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    protected function setUp()
45
    {
46
        parent::setUp();
47
48
        $this->formHelper = $this->getMockBuilder(FormHelper::class)
49
            ->disableOriginalConstructor()
50
            ->getMock();
51
52
        $this->slotsHelper = $this->getMockBuilder(SlotsHelper::class)
53
            ->disableOriginalConstructor()
54
            ->getMock();
55
56
        $this->phpEngine = new PhpEngine(
57
            new TemplateNameParser(),
58
            new FilesystemLoader([__DIR__.'/../../src/Resources/views/Form/%name%']),
59
            [
60
                'form' => $this->formHelper,
61
                'slots' => $this->slotsHelper,
62
                new CKEditorHelper($this->renderer),
63
            ]
64
        );
65
    }
66
67
    /**
68
     * {@inheritdoc}
69
     */
70
    protected function renderTemplate(array $context = [])
71
    {
72
        return $this->phpEngine->render('ckeditor_widget.html.php', $context);
73
    }
74
}
75