diff --git a/src/Symfony/Foundation/Test/WebTestCase.php b/src/Symfony/Foundation/Test/WebTestCase.php index f99db011cb..b82cc1ba56 100644 --- a/src/Symfony/Foundation/Test/WebTestCase.php +++ b/src/Symfony/Foundation/Test/WebTestCase.php @@ -22,6 +22,8 @@ use Symfony\Components\HttpKernel\Test\WebTestCase as BaseWebTestCase; */ abstract class WebTestCase extends BaseWebTestCase { + protected $kernel; + /** * Creates a Client. * @@ -32,10 +34,10 @@ abstract class WebTestCase extends BaseWebTestCase */ public function createClient(array $options = array(), array $server = array()) { - $kernel = $this->createKernel($options); - $kernel->boot(); + $this->kernel = $this->createKernel($options); + $this->kernel->boot(); - $client = $kernel->getContainer()->getTest_ClientService(); + $client = $this->kernel->getContainer()->getTest_ClientService(); $client->setServerParameters($server); $this->setCurrentClient($client); diff --git a/src/Symfony/Framework/WebBundle/Test/WebTestCase.php b/src/Symfony/Framework/WebBundle/Test/WebTestCase.php index 1b18c462aa..bbfac8b94a 100644 --- a/src/Symfony/Framework/WebBundle/Test/WebTestCase.php +++ b/src/Symfony/Framework/WebBundle/Test/WebTestCase.php @@ -4,6 +4,7 @@ namespace Symfony\Framework\WebBundle\Test; use Symfony\Foundation\Test\WebTestCase as BaseWebTestCase; use Symfony\Components\Finder\Finder; +use Symfony\Components\HttpKernel\Response; /* * This file is part of the Symfony package. @@ -23,6 +24,15 @@ use Symfony\Components\Finder\Finder; */ abstract class WebTestCase extends BaseWebTestCase { + public function getProfiler(Response $response) + { + $container = $this->kernel->getContainer(); + + if ($container->hasService('profiler')) { + return $container->getProfilerService()->load($response); + } + } + /** * Creates a Kernel. *