Skip to content

Commit d0230bf

Browse files
authored
MQE-409: [Data Input] Action Groups need to extend persisted data as args
- ActionGroupObject now correctly handles $datakey$ references. - Fixed in-line doc to match structure. - Code Review changes for comments.
1 parent 539aadb commit d0230bf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

+12-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,18 @@ private function resolveNewAttribute($arguments, $attributeValue, $matches)
127127
$newAttributeVal = $attributeValue;
128128
foreach ($matches[1] as $var) {
129129
if (array_key_exists($var, $arguments)) {
130-
$newAttributeVal = str_replace($var, $arguments[$var], $newAttributeVal);
130+
if (preg_match('/\$\$[\w.\[\]\',]+\$\$/', $arguments[$var])) {
131+
//if persisted $$data$$ was passed, return $$param.id$$ instead of {{$$param$$.id}}
132+
$newAttributeVal = str_replace($var, trim($arguments[$var], '$'), $newAttributeVal);
133+
$newAttributeVal = str_replace('{{', '$$', str_replace('}}', '$$', $newAttributeVal));
134+
} elseif (preg_match('/\$[\w.\[\]\',]+\$/', $arguments[$var])) {
135+
//elseif persisted $data$ was passed, return $param.id$ instead of {{$param$.id}}
136+
$newAttributeVal = str_replace($var, trim($arguments[$var], '$'), $newAttributeVal);
137+
$newAttributeVal = str_replace('{{', '$', str_replace('}}', '$', $newAttributeVal));
138+
} else {
139+
//else normal param replacement
140+
$newAttributeVal = str_replace($var, $arguments[$var], $newAttributeVal);
141+
}
131142
}
132143
}
133144

0 commit comments

Comments
 (0)