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()
57
57
{
58
58
$ this ->addData (
59
59
[
60
- 'cache_lifetime ' => false ,
61
60
'cache_tags ' => [\Magento \Store \Model \Store::CACHE_TAG , \Magento \Cms \Model \Block::CACHE_TAG ],
62
61
]
63
62
);
@@ -123,4 +122,14 @@ public function getIdentities()
123
122
{
124
123
return [\Magento \Store \Model \Store::CACHE_TAG , \Magento \Cms \Model \Block::CACHE_TAG ];
125
124
}
125
+
126
+ /**
127
+ * Get block cache life time
128
+ *
129
+ * @return int
130
+ */
131
+ protected function getCacheLifetime ()
132
+ {
133
+ return parent ::getCacheLifetime () ?: 3600 ;
134
+ }
126
135
}
Original file line number Diff line number Diff line change @@ -30,4 +30,18 @@ public function testGetIdentities()
30
30
$ this ->block ->getIdentities ()
31
31
);
32
32
}
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
+ }
33
47
}
You can’t perform that action at this time.
0 commit comments