Explorar el Código

Remove kernel from the web debug toolbar

Antoine Hérault hace 14 años
padre
commit
614cf4c7b0

+ 0 - 1
src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml

@@ -12,7 +12,6 @@
     <services>
         <service id="debug.toolbar" class="%debug.toolbar.class%">
             <tag name="kernel.listener" event="onCoreResponse" priority="-128" />
-            <argument type="service" id="http_kernel" />
             <argument type="service" id="templating.engine.twig" />
             <argument>%debug.toolbar.intercept_redirects%</argument>
         </service>

+ 2 - 5
src/Symfony/Bundle/WebProfilerBundle/Tests/WebDebugToolbarListenerTest.php

@@ -21,14 +21,13 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
      */
     public function testInjectToolbar($content, $expected)
     {
-        $kernel = $this->getMock('Symfony\Bundle\FrameworkBundle\HttpKernel', array(), array(), '', false);
         $templating = $this->getMock('Symfony\Bundle\TwigBundle\TwigEngine', array(), array(), '', false);
         $templating->expects($this->any())
                  ->method('render')
                  ->will($this->returnValue('WDT'));
         ;
         $request = $this->getMock('Symfony\Component\HttpFoundation\Request');
-        $listener = new WebDebugToolbarListener($kernel, $templating);
+        $listener = new WebDebugToolbarListener($templating);
         $m = new \ReflectionMethod($listener, 'injectToolbar');
         $m->setAccessible(true);
 
@@ -51,9 +50,7 @@ class WebDebugToolbarListenerTest extends \PHPUnit_Framework_TestCase
             <head></head>
             <body>
             <textarea><html><head></head><body></body></html></textarea>
-            
-WDT
-</body>
+            \nWDT\n</body>
             </html>"),
         );
     }

+ 2 - 4
src/Symfony/Bundle/WebProfilerBundle/WebDebugToolbarListener.php

@@ -30,13 +30,11 @@ use Symfony\Bundle\TwigBundle\TwigEngine;
  */
 class WebDebugToolbarListener
 {
-    protected $kernel;
     protected $templating;
     protected $interceptRedirects;
 
-    public function __construct(HttpKernel $kernel, TwigEngine $templating, $interceptRedirects = false)
+    public function __construct(TwigEngine $templating, $interceptRedirects = false)
     {
-        $this->kernel = $kernel;
         $this->templating = $templating;
         $this->interceptRedirects = $interceptRedirects;
     }
@@ -48,7 +46,7 @@ class WebDebugToolbarListener
         }
 
         $response = $event->getResponse();
-	$request = $event->getRequest();
+        $request = $event->getRequest();
 
         if ($response->headers->has('X-Debug-Token') && $response->isRedirect() && $this->interceptRedirects) {
             // keep current flashes for one more request