You are here

public function ProfilerListenerTest::testLegacyEventsWithoutRequestStack in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php \Symfony\Component\HttpKernel\Tests\EventListener\ProfilerListenerTest::testLegacyEventsWithoutRequestStack()

Test to ensure BC without RequestStack.

@group legacy

File

vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php, line 30

Class

ProfilerListenerTest

Namespace

Symfony\Component\HttpKernel\Tests\EventListener

Code

public function testLegacyEventsWithoutRequestStack() {
  $profile = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\Profiler\\Profile')
    ->disableOriginalConstructor()
    ->getMock();
  $profiler = $this
    ->getMockBuilder('Symfony\\Component\\HttpKernel\\Profiler\\Profiler')
    ->disableOriginalConstructor()
    ->getMock();
  $profiler
    ->expects($this
    ->once())
    ->method('collect')
    ->will($this
    ->returnValue($profile));
  $kernel = $this
    ->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
  $request = $this
    ->getMockBuilder('Symfony\\Component\\HttpFoundation\\Request')
    ->disableOriginalConstructor()
    ->getMock();
  $response = $this
    ->getMockBuilder('Symfony\\Component\\HttpFoundation\\Response')
    ->disableOriginalConstructor()
    ->getMock();
  $listener = new ProfilerListener($profiler);
  $listener
    ->onKernelRequest(new GetResponseEvent($kernel, $request, Kernel::MASTER_REQUEST));
  $listener
    ->onKernelResponse(new FilterResponseEvent($kernel, $request, Kernel::MASTER_REQUEST, $response));
  $listener
    ->onKernelTerminate(new PostResponseEvent($kernel, $request, $response));
}