예제 #1
0
 public function testGetCacheKeyInfo()
 {
     $info = $this->_block->getCacheKeyInfo();
     $keys = array_keys($info);
     /** order and values of cache key info elements is important */
     $this->assertSame(0, array_shift($keys));
     $this->assertEquals('CATALOG_PRODUCT_NEW', $info[0]);
     $this->assertSame(1, array_shift($keys));
     $this->assertEquals(Mage::app()->getStore()->getId(), $info[1]);
     $this->assertSame(2, array_shift($keys));
     $this->assertEquals(Mage_Core_Model_Theme::CACHE_TAG_NO_THEME, $info[2]);
     $this->assertSame(3, array_shift($keys));
     $this->assertEquals(Mage::getSingleton('Mage_Customer_Model_Session')->getCustomerGroupId(), $info[3]);
     $this->assertSame('template', array_shift($keys));
     /**
      * This block is implemented without template by default (invalid).
      * Having the cache key fragment with empty value can potentially lead to caching bugs
      */
     $this->assertSame(4, array_shift($keys));
     $this->assertNotEquals('', $info[4]);
 }
예제 #2
0
파일: NewTest.php 프로젝트: relue/magento2
 public function testGetCacheKeyInfo()
 {
     $info = $this->_block->getCacheKeyInfo();
     $keys = array_keys($info);
     /** order and values of cache key info elements is important */
     $this->assertSame(0, array_shift($keys));
     $this->assertEquals('CATALOG_PRODUCT_NEW', $info[0]);
     $this->assertSame(1, array_shift($keys));
     $this->assertEquals(Mage::app()->getStore()->getId(), $info[1]);
     $this->assertSame(2, array_shift($keys));
     $this->assertEquals(Mage::getDesign()->getPackageName(), $info[2]);
     $this->assertSame(3, array_shift($keys));
     $this->assertEquals(Mage::getDesign()->getTheme(), $info[3]);
     $this->assertSame(4, array_shift($keys));
     $this->assertNotEquals('', $info[4]);
     $this->assertSame('template', array_shift($keys));
     /**
      * This block is implemented without template by default (invalid).
      * Having the cache key fragment with empty value can potentially lead to caching bugs
      */
     $this->assertSame(5, array_shift($keys));
     $this->assertNotEquals('', $info[5]);
 }
예제 #3
0
 /**
  * Get key pieces for caching block content
  *
  * @return array
  */
 public function getCacheKeyInfo()
 {
     return array_merge(parent::getCacheKeyInfo(), array($this->getDisplayType(), $this->getProductsPerPage(), intval($this->getRequest()->getParam(self::PAGE_VAR_NAME))));
 }
예제 #4
0
 /**
  * Returns array that uniquely identifies this product list in cache storage
  *
  * @return array Cache key info
  * @throws Mage_Core_Exception
  */
 public function getCacheKeyInfo()
 {
     /* get Magento's standard cache key info */
     $cacheKeyInfo = parent::getCacheKeyInfo();
     return $this->_getDispatcherHelper()->dispatchEvent('catalog_product_new_get_cache_key_info', $cacheKeyInfo, 'cache_key_info');
 }