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