public function testValidToken() { $router = $this->getMock('Symfony\\Component\\Routing\\RouterInterface'); $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); $resolver->expects($this->any())->method('getController')->will($this->returnValue(function () { return new Response(); })); $resolver->expects($this->any())->method('getArguments')->will($this->returnValue(array())); $request = Request::create('cache/esi/TOKEN', 'get', array('token' => '44befdbd93f304ea693023aa6587729bed76a206ecdacfd9bbd9b43fcf2e1664', 'parameters' => array('controller' => 'asfsat', 'parameters' => array()))); $cache = new VarnishCache('token', array(), $router, 'ban', $resolver); $cache->cacheAction($request); }
/** * Constructor * * @param string $token A token * @param array $servers An array of servers * @param RouterInterface $router A router instance * @param string $purgeInstruction The purge instruction (purge in Varnish 2, ban in Varnish 3) * @param BlockRendererInterface $blockRenderer A block renderer instance * @param BlockContextManagerInterface $contextManager Block Context manager * @param array $managers An array of managers * @param Recorder $recorder The cache recorder to build the contextual key */ public function __construct($token, array $servers, RouterInterface $router, $purgeInstruction, BlockRendererInterface $blockRenderer, BlockContextManagerInterface $contextManager, array $managers = array(), Recorder $recorder = null) { parent::__construct($token, $servers, $router, $purgeInstruction, null); $this->blockRenderer = $blockRenderer; $this->managers = $managers; $this->contextManager = $contextManager; $this->recorder = $recorder; }
/** * Constructor. * * @param string $token A token * @param FragmentHandler $fragmentHandler A fragment handler * @param RouterInterface $router A router instance * @param BlockRendererInterface $blockRenderer A block renderer instance * @param BlockLoaderInterface $blockLoader A block loader instance * @param BlockContextManagerInterface $blockContextManager A block context manager instance * @param array $servers An array of servers * @param string $purgeInstruction The purge instruction (purge in Varnish 2, ban in Varnish 3) */ public function __construct($token, RouterInterface $router, BlockRendererInterface $blockRenderer, BlockLoaderInterface $blockLoader, BlockContextManagerInterface $blockContextManager, FragmentHandler $fragmentHandler, array $servers = array(), $purgeInstruction) { parent::__construct($token, $servers, $router, $purgeInstruction, null); $this->blockRenderer = $blockRenderer; $this->blockLoader = $blockLoader; $this->blockContextManager = $blockContextManager; $this->fragmentHandler = $fragmentHandler; }