Skip to content

Commit 892b1fb

Browse files
authored
MQE-486: action groups errors with parameterized selectors and array data
- fixed regexPattern for variables to include [] for cases like {{arg.street[0]}} - added check for $variableName = null - fixed camel casing issue with array key
1 parent 7cc6d1c commit 892b1fb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Handlers/DataObjectHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function parseDataEntities()
201201
$arrayValues[] = $arrayValue[self::ARRAY_ELEMENT_ITEM_VALUE];
202202
}
203203

204-
$dataValues[$arrayKey] = $arrayValues;
204+
$dataValues[strtolower($arrayKey)] = $arrayValues;
205205
}
206206
}
207207

src/Magento/FunctionalTestingFramework/Test/Objects/ActionGroupObject.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private function getResolvedActionsWithArgs($arguments, $actionReferenceKey)
8484
// $regexPattern match on: $matches[0] {{section.element(arg.field)}}
8585
// $matches[1] = section.element
8686
// $matches[2] = arg.field
87-
$regexPattern = '/{{([\w.]+)\(*([\w.$\']+)*\)*}}/';
87+
$regexPattern = '/{{([\w.\[\]]+)\(*([\w.$\']+)*\)*}}/';
8888

8989
foreach ($this->parsedActions as $action) {
9090
$varAttributes = array_intersect(self::VAR_ATTRIBUTES, array_keys($action->getCustomActionAttributes()));
@@ -140,10 +140,10 @@ private function replaceAttributeArguments($arguments, $attributeValue, $matches
140140
if (empty($variable)) {
141141
continue;
142142
}
143-
// Truncate arg.field into arg
143+
// Truncate arg.field into arg. If 'Literal' was passed, variableName will be null.
144144
$variableName = strstr($variable, '.', true);
145145
// Check if arguments has a mapping for the given variableName
146-
if (!array_key_exists($variableName, $arguments)) {
146+
if ($variableName == null || !array_key_exists($variableName, $arguments)) {
147147
continue;
148148
}
149149
$isPersisted = strstr($arguments[$variableName], '$');

0 commit comments

Comments
 (0)