Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Forwardport] Fix false cache_lifetime usage in xml layouts #17350

Merged
merged 3 commits into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ protected function getCacheLifetime()

$cacheLifetime = $this->getData('cache_lifetime');
if (false === $cacheLifetime || null === $cacheLifetime) {
return $cacheLifetime;
return null;
}

return (int)$cacheLifetime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ public function getCacheLifetimeDataProvider()
'dataFromCache' => 'dataFromCache',
'dataForSaveCache' => '',
'expectsDispatchEvent' => $this->exactly(2),
'expectsCacheLoad' => $this->once(),
'expectsCacheLoad' => $this->never(),
'expectsCacheSave' => $this->never(),
'expectedResult' => 'dataFromCache',
'expectedResult' => '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good. It would better use null for expected result because we started return null in lib/internal/Magento/Framework/View/Element/AbstractBlock.php line: 1077

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sidolov I tried with null for the expected result in the first two datasets but it does not work when running the unit test.

],
[
'cacheLifetime' => 120,
Expand Down