Skip to content

Commit 6bf60f4

Browse files
committed
AC-6049: Filtering inputs handler in page_cache/block controller
* code cleanup
1 parent 2c9ade2 commit 6bf60f4

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

app/code/Magento/PageCache/Controller/Block.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ abstract class Block extends \Magento\Framework\App\Action\Action
4242
private $layoutCacheKeyName = 'mage_pagecache';
4343

4444
/**
45-
* @var RegexFactory
45+
* @var private RegexFactory
4646
*/
4747
private $regexValidatorFactory;
4848

4949
/**
5050
* Validation pattern for handles array
5151
*/
52-
public const VALIDATION_RULE_PATTERN = '/^[a-z]+[a-z0-9_]*$/i';
52+
private const VALIDATION_RULE_PATTERN = '/^[a-z]+[a-z0-9_]*$/i';
5353

5454
/**
5555
* @param \Magento\Framework\App\Action\Context $context

app/code/Magento/PageCache/Test/Unit/Controller/Block/EsiTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class EsiTest extends TestCase
6666
*/
6767
protected $translateInline;
6868

69+
/**
70+
* Validation pattern for handles array
71+
*/
72+
private const VALIDATION_RULE_PATTERN = '/^[a-z]+[a-z0-9_]*$/i';
73+
6974
/**
7075
* Set up before test
7176
*/
@@ -105,7 +110,7 @@ protected function setUp(): void
105110
->setMethods(['create'])
106111
->getMock();
107112

108-
$regexObject = new Regex('/^[a-z]+[a-z0-9_]*$/i');
113+
$regexObject = new Regex(self::VALIDATION_RULE_PATTERN);
109114

110115
$regexFactoryMock->expects($this->any())->method('create')
111116
->willReturn($regexObject);

app/code/Magento/PageCache/Test/Unit/Controller/Block/RenderTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ class RenderTest extends TestCase
7171
*/
7272
protected $layoutCacheKeyMock;
7373

74+
/**
75+
* Validation pattern for handles array
76+
*/
77+
private const VALIDATION_RULE_PATTERN = '/^[a-z]+[a-z0-9_]*$/i';
78+
7479
/**
7580
* @inheritDoc
7681
*/
@@ -118,7 +123,7 @@ protected function setUp(): void
118123
->setMethods(['create'])
119124
->getMock();
120125

121-
$regexObject = new Regex('/^[a-z]+[a-z0-9_]*$/i');
126+
$regexObject = new Regex(self::VALIDATION_RULE_PATTERN);
122127

123128
$regexFactoryMock->expects($this->any())->method('create')
124129
->willReturn($regexObject);

0 commit comments

Comments
 (0)