public function setUp() { $this->varnishOptions = new VarnishOptions(); $this->varnishOptions->setCacheEnabled(true); $this->listener = new InjectCacheHeaderListener($this->varnishOptions); $this->listener->setLayoutUpdater(new LayoutUpdater()); $this->eventManager = new EventManager(new SharedEventManager()); $this->eventManager->getSharedManager()->clearListeners(InjectCacheHeaderListener::class); $this->attachStrategy(DefaultStrategy::class, 100); $this->listener->setEventManager($this->eventManager); $this->createMvcEvent(); }
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { /** @var VarnishOptions $varnishOptions */ $varnishOptions = $container->get(VarnishOptions::class); $routeListener = new InjectCacheHeaderListener($varnishOptions); if ($container->has('ConLayout\\Updater\\LayoutUpdaterInterface')) { $routeListener->setLayoutUpdater($container->get(LayoutUpdaterInterface::class)); } return $routeListener; }