public function TraceableEventDispatcherTest::testStopwatchSections

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/TraceableEventDispatcherTest.php, line 165

Class

TraceableEventDispatcherTest

Namespace

Symfony\Component\HttpKernel\Tests\Debug

Code

public function testStopwatchSections() {
  $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), $stopwatch = new Stopwatch());
  $kernel = $this
    ->getHttpKernel($dispatcher, function () {
    return new Response();
  });
  $request = Request::create('/');
  $response = $kernel
    ->handle($request);
  $kernel
    ->terminate($request, $response);
  $events = $stopwatch
    ->getSectionEvents($response->headers
    ->get('X-Debug-Token'));
  $this
    ->assertEquals(array(
    '__section__',
    'kernel.request',
    'kernel.request.loading',
    'kernel.controller',
    'kernel.controller.loading',
    'controller',
    'kernel.response',
    'kernel.response.loading',
    'kernel.terminate',
    'kernel.terminate.loading',
  ), array_keys($events));
}