-
Notifications
You must be signed in to change notification settings - Fork 2
/
TwigFrontendTemplateTest.php
39 lines (32 loc) · 1.21 KB
/
TwigFrontendTemplateTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*
* Copyright (c) 2022 Heimrich & Hannot GmbH
*
* @license LGPL-3.0-or-later
*/
namespace HeimrichHannot\TwigSupportBundle\Test\Template;
use Contao\System;
use Contao\TestCase\ContaoTestCase;
use HeimrichHannot\TwigSupportBundle\EventListener\RenderListener;
use HeimrichHannot\TwigSupportBundle\Template\TwigFrontendTemplate;
class TwigFrontendTemplateTest extends ContaoTestCase
{
/**
* @runInSeparateProcess
*/
public function testInherit()
{
$instance = $this->getMockBuilder(TwigFrontendTemplate::class)->disableOriginalConstructor()->setMethods(null)->getMock();
$container = $this->getContainerWithContaoConfiguration();
System::setContainer($container);
$this->assertEmpty($instance->inherit());
$renderListener = $this->createMock(RenderListener::class);
$container->set(RenderListener::class, $renderListener);
System::setContainer($container);
$this->assertEmpty($instance->inherit());
$instance->setName('huh_foo_bar');
$this->assertEmpty($instance->inherit());
$renderListener->method('render')->willReturn('<p>Foo bar</p>');
$this->assertSame('<p>Foo bar</p>', $instance->inherit());
}
}