File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
lib/internal/Magento/Framework/View/Test/Unit/Element Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1515use Magento \Framework \Config \View ;
1616use Magento \Framework \Escaper ;
1717use Magento \Framework \Event \ManagerInterface as EventManagerInterface ;
18+ use Magento \Framework \Exception \LocalizedException ;
1819use Magento \Framework \ObjectManagerInterface ;
1920use Magento \Framework \Session \SessionManagerInterface ;
2021use 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 */
You can’t perform that action at this time.
0 commit comments