TerminateEvent example

'type' => CacheableNormalization::permanent($resource_object->getTypeName()),
        'id' => CacheableNormalization::permanent($resource_object->getId()),
        'links' => $normalized_links,
      ],
      ResourceObjectNormalizationCacher::RESOURCE_CACHE_SUBSET_FIELDS => [],
    ];
    $this->cacher->saveOnTerminate($resource_object$normalization_parts);

    $http_kernel = $this->prophesize(HttpKernelInterface::class);
    $request = $this->prophesize(Request::class);
    $response = $this->prophesize(Response::class);
    $event = new TerminateEvent($http_kernel->reveal()$request->reveal()$response->reveal());
    $this->cacher->onTerminate($event);
    $this->assertNotFalse((bool) $this->cacher->get($resource_object));
    Cache::invalidateTags([$cache_tag_to_invalidate]);
    $this->assertFalse((bool) $this->cacher->get($resource_object));
  }

}

                });
            }
        }
    }

    /** * @return void */
    public function terminate(Request $request, Response $response)
    {
        $this->dispatcher->dispatch(new TerminateEvent($this$request$response), KernelEvents::TERMINATE);
    }

    /** * @internal */
    public function terminateWithException(\Throwable $exception, Request $request = null): void
    {
        if (!$request ??= $this->requestStack->getMainRequest()) {
            throw $exception;
        }

        
$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));
    }

    /** * @dataProvider collectRequestProvider */
    public function testCollectParameter(Request $request, ?bool $enable)
    {
        $profile = new Profile('token');

        $profiler = $this->createMock(Profiler::class);
        $profiler->expects($this->once())
            

                });
            }
        }
    }

    /** * @return void */
    public function terminate(Request $request, Response $response)
    {
        $this->dispatcher->dispatch(new TerminateEvent($this$request$response), KernelEvents::TERMINATE);
    }

    /** * @internal */
    public function terminateWithException(\Throwable $exception, Request $request = null): void
    {
        if (!$request ??= $this->requestStack->getMainRequest()) {
            throw $exception;
        }

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