Skip to content

Commit 8286dc2

Browse files
committed
Merge branch 'AC-9832' of github.com:magento-cia/magento2ce into AC-9831
2 parents ff44a19 + 1c8fb80 commit 8286dc2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/internal/Magento/Framework/View/Test/Unit/Element/AbstractBlockTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Magento\Framework\Config\View;
1616
use Magento\Framework\Escaper;
1717
use Magento\Framework\Event\ManagerInterface as EventManagerInterface;
18+
use Magento\Framework\Exception\LocalizedException;
1819
use Magento\Framework\ObjectManagerInterface;
1920
use Magento\Framework\Session\SessionManagerInterface;
2021
use Magento\Framework\Session\SidResolverInterface;
@@ -242,6 +243,19 @@ public function testGetCacheKey()
242243
$this->assertEquals(AbstractBlock::CUSTOM_CACHE_KEY_PREFIX . $cacheKey, $this->block->getCacheKey());
243244
}
244245

246+
/**
247+
* @return void
248+
* @throws LocalizedException
249+
*/
250+
public function testGetCacheKeyFail()
251+
{
252+
$cacheKey = "test&''Key";
253+
$this->block->setData('cache_key', $cacheKey);
254+
$this->expectException(LocalizedException::class);
255+
$this->expectExceptionMessage((string)__('Please enter cache key with only alphanumeric or hash string.'));
256+
$this->block->getCacheKey();
257+
}
258+
245259
/**
246260
* @return void
247261
*/

0 commit comments

Comments
 (0)