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)
6565 if ($ container ->has ('fragment.handler ' )) {
6666 $ container ->getDefinition ('twig.extension.httpkernel ' )->addTag ('twig.extension ' );
6767
68+ $ container ->getDefinition ('twig.runtime.httpkernel ' )
69+ ->replaceArgument (0 , new Reference ('fragment.handler ' ))
70+ ->addTag ('twig.runtime ' )
71+ ;
72+
6873 // inject Twig in the hinclude service if Twig is the only registered templating engine
6974 if ((!$ container ->hasParameter ('templating.engines ' ) || array ('twig ' ) == $ container ->getParameter ('templating.engines ' )) && $ container ->hasDefinition ('fragment.renderer.hinclude ' )) {
7075 $ container ->getDefinition ('fragment.renderer.hinclude ' )
@@ -74,6 +79,12 @@ public function process(ContainerBuilder $container)
7479 }
7580 }
7681
82+ if ($ container ->has ('http_kernel ' )) {
83+ $ container ->getDefinition ('twig.controller.preview_error ' )
84+ ->replaceArgument (0 , new Reference ('http_kernel ' ))
85+ ;
86+ }
87+
7788 if ($ container ->has ('request_stack ' )) {
7889 $ container ->getDefinition ('twig.extension.httpfoundation ' )->addTag ('twig.extension ' );
7990 }
Original file line number Diff line number Diff line change 104104 <service id =" twig.extension.httpkernel" class =" Symfony\Bridge\Twig\Extension\HttpKernelExtension" />
105105
106106 <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 />
109108 </service >
110109
111110 <service id =" twig.extension.httpfoundation" class =" Symfony\Bridge\Twig\Extension\HttpFoundationExtension" >
142141 </service >
143142
144143 <service id =" twig.controller.preview_error" class =" Symfony\Bundle\TwigBundle\Controller\PreviewErrorController" public =" true" >
145- <argument type = " service " id = " http_kernel " />
144+ <argument />
146145 <argument >%twig.exception_listener.controller%</argument >
147146 </service >
148147
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