From dd8d0ef1736e15702a4281e5bae90cac4736fb25 Mon Sep 17 00:00:00 2001 From: Susan Wright Date: Wed, 5 Oct 2016 14:54:07 -0700 Subject: [PATCH] Backport of MAGETWO-59089 for Magento 2.1: Magento 2.1.1 Problem with change currency Fixed issues: - MAGETWO-59089 [Github]Magento 2.1.1 Problem with change currency #6746 (cherry picked from commit a9510d3166e4016d2cc2977d7b785f0676d52afd) --- .../Magento/Framework/Pricing/Render/PriceBox.php | 2 +- .../Pricing/Test/Unit/Render/PriceBoxTest.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Pricing/Render/PriceBox.php b/lib/internal/Magento/Framework/Pricing/Render/PriceBox.php index 39422210750cc..75ef83775741d 100644 --- a/lib/internal/Magento/Framework/Pricing/Render/PriceBox.php +++ b/lib/internal/Magento/Framework/Pricing/Render/PriceBox.php @@ -86,7 +86,7 @@ public function getCacheKey() */ protected function getCacheLifetime() { - return parent::hasCacheLifetime() ? parent::getCacheLifetime() : self::DEFAULT_LIFETIME; + return parent::hasCacheLifetime() ? parent::getCacheLifetime() : null; } /** diff --git a/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php b/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php index af6ef0a099584..1f1fe3dff15ea 100644 --- a/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php +++ b/lib/internal/Magento/Framework/Pricing/Test/Unit/Render/PriceBoxTest.php @@ -233,4 +233,17 @@ public function testGetRendererPool() { $this->assertEquals($this->rendererPool, $this->model->getRendererPool()); } + + /** + * This tests ensures that protected method getCacheLifetime() returns a null value when cacheLifeTime is not + * explicitly set in the parent block + */ + public function testCacheLifetime() + { + $reflectionClass = new \ReflectionClass(get_class($this->model)); + $methodReflection = $reflectionClass->getMethod('getCacheLifetime'); + $methodReflection->setAccessible(true); + $cacheLifeTime = $methodReflection->invoke($this->model); + $this->assertNull($cacheLifeTime, 'Expected null cache lifetime'); + } }