Skip to content

Commit edcbe78

Browse files
MAGETWO-88264: [Forwardport] Remove forced setting of cache_lifetime to false in constructor and set default cache_lifetime to 3600 #13785
- Merge Pull Request #13785 from nmalevanec/magento2:2.3-develop-PR-port-13762 - Merged commits: 1. 53c7321 2. 2407845
2 parents c166940 + 2407845 commit edcbe78

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

app/code/Magento/Theme/Block/Html/Footer.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

app/code/Magento/Theme/Test/Unit/Block/Html/FooterTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)