| 1 | <?php |
||
| 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 |