Skip to content

Commit f87d495

Browse files
[2.5] cleanup deprecated uses
1 parent f53fc2b commit f87d495

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Tests/EventListener/ProfilerListenerTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\HttpKernel\Tests\EventListener;
1313

14+
use Symfony\Component\HttpFoundation\RequestStack;
1415
use Symfony\Component\HttpKernel\EventListener\ProfilerListener;
1516
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
1617
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
@@ -23,11 +24,11 @@ class ProfilerListenerTest extends \PHPUnit_Framework_TestCase
2324
{
2425
/**
2526
* Test to ensure BC without RequestStack
26-
*
27-
* @deprecated Deprecated since version 2.4, to be removed in 3.0.
2827
*/
29-
public function testEventsWithoutRequestStack()
28+
public function testLegacyEventsWithoutRequestStack()
3029
{
30+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
31+
3132
$profile = $this->getMockBuilder('Symfony\Component\HttpKernel\Profiler\Profile')
3233
->disableOriginalConstructor()
3334
->getMock();
@@ -86,15 +87,16 @@ public function testKernelTerminate()
8687
->disableOriginalConstructor()
8788
->getMock();
8889

90+
$requestStack = new RequestStack();
91+
$requestStack->push($masterRequest);
92+
8993
$onlyException = true;
90-
$listener = new ProfilerListener($profiler, null, $onlyException);
94+
$listener = new ProfilerListener($profiler, null, $onlyException, false, $requestStack);
9195

9296
// master request
93-
$listener->onKernelRequest(new GetResponseEvent($kernel, $masterRequest, Kernel::MASTER_REQUEST));
9497
$listener->onKernelResponse(new FilterResponseEvent($kernel, $masterRequest, Kernel::MASTER_REQUEST, $response));
9598

9699
// sub request
97-
$listener->onKernelRequest(new GetResponseEvent($kernel, $subRequest, Kernel::SUB_REQUEST));
98100
$listener->onKernelException(new GetResponseForExceptionEvent($kernel, $subRequest, Kernel::SUB_REQUEST, new HttpException(404)));
99101
$listener->onKernelResponse(new FilterResponseEvent($kernel, $subRequest, Kernel::SUB_REQUEST, $response));
100102

0 commit comments

Comments
 (0)