/** * Commence page caching for any cacheable actions * * @return void */ public function preDispatch() { if ($this->getResponse()->isRedirect() || !$this->isEnabled() || $this->_requestUriTooLong()) { return true; } return parent::preDispatch(); }
public function testPreDispatchDoesNotCallCachesStartMethodWithBadAction() { $helper = new Zend_Controller_Action_Helper_Cache(); $cache = new Mock_Zend_Cache_Page_4(); $helper->setCache('page', $cache); $helper->preDispatch(); $this->assertNotEquals('verified', $cache->res); }
/** * @group ZF-11885 * @dataProvider dataprovider_testEncodedCacheIdsAreUsedConsistently */ public function testRemovePageAcceptsPreEncodedCacheIds($recursive) { $helper = new Zend_Controller_Action_Helper_Cache(); $cache = new Mock_Zend_Cache_Page_TestingEncodedCacheId(); $helper->setCache('page', $cache); $helper->direct(array('baz')); $helper->preDispatch(); $uriKey = bin2hex($this->request->getRequestUri()); // Ensure that remove method will accept pre-encoded key $helper->removePage($uriKey, $recursive); $this->assertFalse(isset($cache->items[$uriKey])); }