ProfilerListener example

->willReturn($profile);

        $kernel = $this->createMock(HttpKernelInterface::class);
        $mainRequest = $this->createMock(Request::class);
        $subRequest = $this->createMock(Request::class);
        $response = $this->createMock(Response::class);

        $requestStack = new RequestStack();
        $requestStack->push($mainRequest);

        $onlyException = true;
        $listener = new ProfilerListener($profiler$requestStack, null, $onlyException);

        // main request         $listener->onKernelResponse(new ResponseEvent($kernel$mainRequest, Kernel::MAIN_REQUEST, $response));

        // sub request         $listener->onKernelException(new ExceptionEvent($kernel$subRequest, Kernel::SUB_REQUEST, new HttpException(404)));
        $listener->onKernelResponse(new ResponseEvent($kernel$subRequest, Kernel::SUB_REQUEST, $response));

        $listener->onKernelTerminate(new TerminateEvent($kernel$mainRequest$response));
    }

    
Home | Imprint | This part of the site doesn't use cookies.