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; }
public function testStrategyWithoutMatch() { $this->attachStrategy(RouteStrategy::class, 200); $this->attachStrategy(ActionStrategy::class, 600); $this->varnishOptions->setCacheableActions(['No\\Match*' => 120]); $this->varnishOptions->setCacheableRoutes(['test/route' => 360]); $this->listener->injectCacheHeader($this->mvcEvent); $this->assertEquals(360, $this->listener->getTtl()); }