File tree Expand file tree Collapse file tree 6 files changed +64
-56
lines changed
src/Symfony/Bundle/TwigBundle
DependencyInjection/Compiler Expand file tree Collapse file tree 6 files changed +64
-56
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ public function process(ContainerBuilder $container)
65
65
if ($ container ->has ('fragment.handler ' )) {
66
66
$ container ->getDefinition ('twig.extension.httpkernel ' )->addTag ('twig.extension ' );
67
67
68
+ $ container ->getDefinition ('twig.runtime.httpkernel ' )
69
+ ->replaceArgument (0 , new Reference ('fragment.handler ' ))
70
+ ->addTag ('twig.runtime ' )
71
+ ;
72
+
68
73
// inject Twig in the hinclude service if Twig is the only registered templating engine
69
74
if ((!$ container ->hasParameter ('templating.engines ' ) || array ('twig ' ) == $ container ->getParameter ('templating.engines ' )) && $ container ->hasDefinition ('fragment.renderer.hinclude ' )) {
70
75
$ container ->getDefinition ('fragment.renderer.hinclude ' )
@@ -74,6 +79,12 @@ public function process(ContainerBuilder $container)
74
79
}
75
80
}
76
81
82
+ if ($ container ->has ('http_kernel ' )) {
83
+ $ container ->getDefinition ('twig.controller.preview_error ' )
84
+ ->replaceArgument (0 , new Reference ('http_kernel ' ))
85
+ ;
86
+ }
87
+
77
88
if ($ container ->has ('request_stack ' )) {
78
89
$ container ->getDefinition ('twig.extension.httpfoundation ' )->addTag ('twig.extension ' );
79
90
}
Original file line number Diff line number Diff line change 104
104
<service id =" twig.extension.httpkernel" class =" Symfony\Bridge\Twig\Extension\HttpKernelExtension" />
105
105
106
106
<service id =" twig.runtime.httpkernel" class =" Symfony\Bridge\Twig\Extension\HttpKernelRuntime" >
107
- <argument type =" service" id =" fragment.handler" />
108
- <tag name =" twig.runtime" />
107
+ <argument />
109
108
</service >
110
109
111
110
<service id =" twig.extension.httpfoundation" class =" Symfony\Bridge\Twig\Extension\HttpFoundationExtension" >
142
141
</service >
143
142
144
143
<service id =" twig.controller.preview_error" class =" Symfony\Bundle\TwigBundle\Controller\PreviewErrorController" public =" true" >
145
- <argument type = " service " id = " http_kernel " />
144
+ <argument />
146
145
<argument >%twig.exception_listener.controller%</argument >
147
146
</service >
148
147
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ /*
4
+ * This file is part of the Symfony package.
5
+ *
6
+ * (c) Fabien Potencier <fabien@symfony.com>
7
+ *
8
+ * For the full copyright and license information, please view the LICENSE
9
+ * file that was distributed with this source code.
10
+ */
11
+
12
+ namespace Symfony \Bundle \TwigBundle \Tests \Functional ;
13
+
14
+ use Symfony \Bundle \TwigBundle \Tests \TestCase ;
15
+ use Symfony \Bundle \TwigBundle \TwigBundle ;
16
+ use Symfony \Component \Config \Loader \LoaderInterface ;
17
+ use Symfony \Component \HttpKernel \Kernel ;
18
+
19
+ class EmptyAppTest extends TestCase
20
+ {
21
+ public function testBootEmptyApp ()
22
+ {
23
+ $ kernel = new EmptyAppKernel ('test ' , true );
24
+ $ kernel ->boot ();
25
+
26
+ $ this ->assertTrue ($ kernel ->getContainer ()->hasParameter ('twig.default_path ' ));
27
+ $ this ->assertNotEmpty ($ kernel ->getContainer ()->getParameter ('twig.default_path ' ));
28
+ }
29
+ }
30
+
31
+ class EmptyAppKernel extends Kernel
32
+ {
33
+ public function registerBundles ()
34
+ {
35
+ return array (new TwigBundle ());
36
+ }
37
+
38
+ public function registerContainerConfiguration (LoaderInterface $ loader )
39
+ {
40
+ }
41
+
42
+ public function getCacheDir ()
43
+ {
44
+ return sys_get_temp_dir ().'/ ' .Kernel::VERSION .'/EmptyAppKernel/cache/ ' .$ this ->environment ;
45
+ }
46
+
47
+ public function getLogDir ()
48
+ {
49
+ return sys_get_temp_dir ().'/ ' .Kernel::VERSION .'/EmptyAppKernel/logs ' ;
50
+ }
51
+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments