Skip to content

Commit 1c7c6ce

Browse files
committed
MQE-1676: Add a static-check that ensures action groups do not have unused arguments
included $$argument.name$$ pattern + fixed unit tests
1 parent 28fe757 commit 1c7c6ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Magento/FunctionalTestingFramework/StaticCheck/ActionGroupArgumentsCheck.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class ActionGroupArgumentsCheck implements StaticCheckInterface
2727
const ACTIONGROUP_NAME_REGEX_PATTERN = '/<actionGroup name=["\']([^\'"]*)/';
2828

2929
const ERROR_LOG_FILENAME = 'mftf-arguments-checks';
30-
const ERROR_LOG_MESSAGE = 'MFTF Unused Arguments Check';
30+
const ERROR_LOG_MESSAGE = 'MFTF Action Group Unused Arguments Check';
3131

3232
/**
3333
* Array containing all errors found after running the execute() function.
@@ -141,13 +141,13 @@ private function findUnusedArguments($actionGroupXml)
141141
preg_match(self::ACTIONGROUP_NAME_REGEX_PATTERN, $actionGroupXml, $actionGroupName);
142142
try {
143143
$actionGroup = ActionGroupObjectHandler::getInstance()->getObject($actionGroupName[1]);
144-
} catch (XmlException $e){
144+
} catch (XmlException $e) {
145145
}
146146
foreach ($arguments[1] as $argument) {
147147
//pattern to match all argument references
148148
$patterns = [
149149
'(\{{2}' . $argument . '(\.[a-zA-Z0-9_\[\]\(\).,\'\/ ]+)?}{2})',
150-
'([(,\s\']' . $argument . '(\.[a-zA-Z0-9_\[\]]+)?[),\s\'])'
150+
'([(,\s\'$$]' . $argument . '(\.[a-zA-Z0-9_$\[\]]+)?[),\s\'])'
151151
];
152152
// matches entity references
153153
if (preg_match($patterns[0], $actionGroupXml)) {

0 commit comments

Comments
 (0)