Преглед на файлове

[FrameworkBundle] made possible to interact with the Kernel/Container after a request in functional tests

Fabien Potencier преди 14 години
родител
ревизия
91602dfef4
променени са 1 файла, в които са добавени 4 реда и са изтрити 24 реда
  1. 4 24
      src/Symfony/Bundle/FrameworkBundle/Client.php

+ 4 - 24
src/Symfony/Bundle/FrameworkBundle/Client.php

@@ -14,8 +14,6 @@ namespace Symfony\Bundle\FrameworkBundle;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Symfony\Component\HttpKernel\HttpKernelInterface;
 use Symfony\Component\HttpKernel\Client as BaseClient;
-use Symfony\Component\BrowserKit\History;
-use Symfony\Component\BrowserKit\CookieJar;
 use Symfony\Component\HttpKernel\Profiler\Profiler as HttpProfiler;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpFoundation\Response;
@@ -27,23 +25,6 @@ use Symfony\Component\HttpFoundation\Response;
  */
 class Client extends BaseClient
 {
-    protected $container;
-
-    /**
-     * Constructor.
-     *
-     * @param HttpKernelInterface $kernel    An HttpKernelInterface instance
-     * @param array               $server    The server parameters (equivalent of $_SERVER)
-     * @param History             $history   A History instance to store the browser history
-     * @param CookieJar           $cookieJar A CookieJar instance to store the cookies
-     */
-    public function __construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
-    {
-        parent::__construct($kernel, $server, $history, $cookieJar);
-
-        $this->container = $kernel->getContainer();
-    }
-
     /**
      * Returns the container.
      *
@@ -51,7 +32,7 @@ class Client extends BaseClient
      */
     public function getContainer()
     {
-        return $this->container;
+        return $this->kernel->getContainer();
     }
 
     /**
@@ -71,11 +52,11 @@ class Client extends BaseClient
      */
     public function getProfiler()
     {
-        if (!$this->container->has('profiler')) {
+        if (!$this->kernel->getContainer()->has('profiler')) {
             return false;
         }
 
-        return $this->container->get('profiler')->loadFromResponse($this->response);
+        return $this->kernel->getContainer()->get('profiler')->loadFromResponse($this->response);
     }
 
     /**
@@ -87,10 +68,9 @@ class Client extends BaseClient
      */
     protected function doRequest($request)
     {
-        $returnValue = $this->kernel->handle($request);
         $this->kernel->shutdown();
 
-        return $returnValue;
+        return $this->kernel->handle($request);
     }
 
     /**