فهرست منبع

moved getProfile() from the WebTestCase to the Client

Fabien Potencier 15 سال پیش
والد
کامیت
220f8cecec
2فایلهای تغییر یافته به همراه14 افزوده شده و 16 حذف شده
  1. 14 0
      src/Symfony/Foundation/Client.php
  2. 0 16
      src/Symfony/Framework/FoundationBundle/Test/WebTestCase.php

+ 14 - 0
src/Symfony/Foundation/Client.php

@@ -62,6 +62,20 @@ class Client extends BaseClient
         return $this->kernel;
     }
 
+    /**
+     * Gets a profiler for the current Response.
+     *
+     * @return Symfony\Components\HttpKernel\Profiler\Profiler A Profiler instance
+     */
+    public function getProfiler()
+    {
+        if (!$this->container->hasService('profiler')) {
+            return false;
+        }
+
+        return $this->container->getProfilerService()->load($this->response);
+    }
+
     /**
      * Makes a request.
      *

+ 0 - 16
src/Symfony/Framework/FoundationBundle/Test/WebTestCase.php

@@ -24,22 +24,6 @@ use Symfony\Components\HttpKernel\Response;
  */
 abstract class WebTestCase extends BaseWebTestCase
 {
-    /**
-     * Gets a profiler for the given Response.
-     *
-     * @param Symfony\Components\HttpKernel\Response $response A Response instance
-     *
-     * @return Symfony\Components\HttpKernel\Profiler\Profiler A Profiler instance
-     */
-    public function getProfiler(Response $response)
-    {
-        $container = $this->kernel->getContainer();
-
-        if ($container->hasService('profiler')) {
-            return $container->getProfilerService()->load($response);
-        }
-    }
-
     /**
      * Creates a Kernel.
      *