diff --git a/app/code/Magento/Theme/Block/Html/Footer.php b/app/code/Magento/Theme/Block/Html/Footer.php index 4cd63462ec754..cdb350336f38f 100644 --- a/app/code/Magento/Theme/Block/Html/Footer.php +++ b/app/code/Magento/Theme/Block/Html/Footer.php @@ -57,7 +57,6 @@ protected function _construct() { $this->addData( [ - 'cache_lifetime' => false, 'cache_tags' => [\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG], ] ); @@ -123,4 +122,14 @@ public function getIdentities() { return [\Magento\Store\Model\Store::CACHE_TAG, \Magento\Cms\Model\Block::CACHE_TAG]; } + + /** + * Get block cache life time + * + * @return int + */ + protected function getCacheLifetime() + { + return parent::getCacheLifetime() ?: 3600; + } } diff --git a/app/code/Magento/Theme/Test/Unit/Block/Html/FooterTest.php b/app/code/Magento/Theme/Test/Unit/Block/Html/FooterTest.php index 8451e9c5aee6a..52175cc669bbd 100644 --- a/app/code/Magento/Theme/Test/Unit/Block/Html/FooterTest.php +++ b/app/code/Magento/Theme/Test/Unit/Block/Html/FooterTest.php @@ -30,4 +30,18 @@ public function testGetIdentities() $this->block->getIdentities() ); } + + /** + * Check Footer block has cache lifetime. + * + * @throws \ReflectionException + * @return void + */ + public function testGetCacheLifetime() + { + $reflection = new \ReflectionClass($this->block); + $method = $reflection->getMethod('getCacheLifetime'); + $method->setAccessible(true); + $this->assertEquals(3600, $method->invoke($this->block)); + } }