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 testOptions() { $options = new VarnishOptions(); $options->setCacheEnabled(true); $this->assertTrue($options->isCacheEnabled()); $options->setCacheableRoutes(['test/route' => 60]); $this->assertEquals(['test/route' => 60], $options->getCacheableRoutes()); $options->setPolicy(VarnishOptions::POLICY_ALLOW); $this->assertEquals(VarnishOptions::POLICY_ALLOW, $options->getPolicy()); $options->setDebug(true); $this->assertTrue($options->getDebug()); $options->setDefaultTtl(3600); $this->assertEquals(3600, $options->getDefaultTtl()); $options->setServers(['server1' => ['host' => '127.0.0.1']]); $this->assertEquals(['server1' => ['host' => '127.0.0.1']], $options->getServers()); }