/** * @param PostResponseEvent $event */ public function onKernelTerminate(PostResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if ($span = $this->spanStack->pop()) { $this->tracer->trace([$this->httpFoundationSpanFactory->fromOutgoingResponse($event->getResponse(), $span)]); } }
function it_traces_the_response_and_pop_the_stack(HttpFoundationSpanFactory $httpFoundationSpanFactory, Tracer $tracer, SpanStack $spanStack, Span $span, PostResponseEvent $event) { $response = new Response(); $event->isMasterRequest()->willReturn(true); $event->getResponse()->willReturn($response); $spanStack->pop()->shouldBeCalled()->willReturn($span); $httpFoundationSpanFactory->fromOutgoingResponse($response, $span)->shouldBeCalled()->willReturn($span); $tracer->trace([$span])->shouldBeCalled(); $this->onKernelTerminate($event); }