File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed
lib/internal/Magento/Framework/View Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 12
12
use Magento \Framework \Cache \LockGuardedCacheLoader ;
13
13
use Magento \Framework \Config \ConfigOptionsListConstants ;
14
14
use Magento \Framework \DataObject \IdentityInterface ;
15
+ use Magento \Framework \Exception \RuntimeException ;
15
16
16
17
/**
17
18
* Base class for all blocks.
@@ -1043,17 +1044,13 @@ public function getCacheKeyInfo()
1043
1044
* Get Key for caching block content
1044
1045
*
1045
1046
* @return string
1046
- * @throws \Magento\Framework\Exception\LocalizedException
1047
+ * @throws RuntimeException
1047
1048
*/
1048
1049
public function getCacheKey ()
1049
1050
{
1050
1051
if ($ this ->hasData ('cache_key ' )) {
1051
1052
if (preg_match ('/[^a-z0-9\-\_]/i ' , $ this ->getData ('cache_key ' ))) {
1052
- throw new \Magento \Framework \Exception \LocalizedException (
1053
- __ (
1054
- 'Please enter cache key with only alphanumeric or hash string. '
1055
- )
1056
- );
1053
+ throw new RuntimeException (__ ('Please enter cache key with only alphanumeric or hash string. ' ));
1057
1054
}
1058
1055
1059
1056
return static ::CUSTOM_CACHE_KEY_PREFIX . $ this ->getData ('cache_key ' );
Original file line number Diff line number Diff line change 15
15
use Magento \Framework \Config \View ;
16
16
use Magento \Framework \Escaper ;
17
17
use Magento \Framework \Event \ManagerInterface as EventManagerInterface ;
18
- use Magento \Framework \Exception \LocalizedException ;
18
+ use Magento \Framework \Exception \RuntimeException ;
19
19
use Magento \Framework \ObjectManagerInterface ;
20
20
use Magento \Framework \Session \SessionManagerInterface ;
21
21
use Magento \Framework \Session \SidResolverInterface ;
@@ -246,13 +246,13 @@ public function testGetCacheKey()
246
246
/**
247
247
* Test for invalid cacheKey name
248
248
* @return void
249
- * @throws LocalizedException
249
+ * @throws RuntimeException
250
250
*/
251
251
public function testGetCacheKeyFail (): void
252
252
{
253
253
$ cacheKey = "test&''Key " ;
254
254
$ this ->block ->setData ('cache_key ' , $ cacheKey );
255
- $ this ->expectException (LocalizedException ::class);
255
+ $ this ->expectException (RuntimeException ::class);
256
256
$ this ->expectExceptionMessage ((string )__ ('Please enter cache key with only alphanumeric or hash string. ' ));
257
257
$ this ->block ->getCacheKey ();
258
258
}
You can’t perform that action at this time.
0 commit comments