File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,6 @@ protected function _construct()
5757 {
5858 $ this ->addData (
5959 [
60- 'cache_lifetime ' => false ,
6160 'cache_tags ' => [\Magento \Store \Model \Store::CACHE_TAG , \Magento \Cms \Model \Block::CACHE_TAG ],
6261 ]
6362 );
@@ -123,4 +122,14 @@ public function getIdentities()
123122 {
124123 return [\Magento \Store \Model \Store::CACHE_TAG , \Magento \Cms \Model \Block::CACHE_TAG ];
125124 }
125+
126+ /**
127+ * Get block cache life time
128+ *
129+ * @return int
130+ */
131+ protected function getCacheLifetime ()
132+ {
133+ return parent ::getCacheLifetime () ?: 3600 ;
134+ }
126135}
Original file line number Diff line number Diff line change @@ -30,4 +30,18 @@ public function testGetIdentities()
3030 $ this ->block ->getIdentities ()
3131 );
3232 }
33+
34+ /**
35+ * Check Footer block has cache lifetime.
36+ *
37+ * @throws \ReflectionException
38+ * @return void
39+ */
40+ public function testGetCacheLifetime ()
41+ {
42+ $ reflection = new \ReflectionClass ($ this ->block );
43+ $ method = $ reflection ->getMethod ('getCacheLifetime ' );
44+ $ method ->setAccessible (true );
45+ $ this ->assertEquals (3600 , $ method ->invoke ($ this ->block ));
46+ }
3347}
You can’t perform that action at this time.
0 commit comments