From 9e6f4b2122914d8175d846fc18a4b9a79d65a4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 25 Jun 2019 17:43:39 +0200 Subject: [PATCH] [FrameworkBundle] Fix calling Client::getProfile() before sending a request --- src/Symfony/Bundle/FrameworkBundle/Client.php | 2 +- .../FrameworkBundle/Tests/Functional/ProfilerTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 6473f97584f3..6c75b5ab1402 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -66,7 +66,7 @@ public function getKernel() */ public function getProfile() { - if (!$this->kernel->getContainer()->has('profiler')) { + if (null === $this->response || !$this->kernel->getContainer()->has('profiler')) { return false; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php index c5252c0d5892..2768b59a1c3f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php @@ -28,9 +28,9 @@ public function testProfilerIsDisabled($insulate) // enable the profiler for the next request $client->enableProfiler(); - $crawler = $client->request('GET', '/profiler'); - $profile = $client->getProfile(); - $this->assertInternalType('object', $profile); + $this->assertFalse($client->getProfile()); + $client->request('GET', '/profiler'); + $this->assertInternalType('object', $client->getProfile()); $client->request('GET', '/profiler'); $this->assertFalse($client->getProfile());