Skip to content

Commit 4e2b266

Browse files
Cristian101jilu1
authored andcommitted
The property of the parent element is used first when making a request
(cherry picked from commit f463ebd)
1 parent 8221bc8 commit 4e2b266

File tree

1 file changed

+22
-4
lines changed
  • src/Magento/FunctionalTestingFramework/DataGenerator/Persist

1 file changed

+22
-4
lines changed

src/Magento/FunctionalTestingFramework/DataGenerator/Persist/CurlHandler.php

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,31 @@ private function resolveUrlReference($urlIn, $entityObjects)
201201

202202
if (!empty($matchedParams)) {
203203
foreach ($matchedParams[0] as $paramKey => $paramValue) {
204+
205+
$paramEntityParent = "";
206+
$matchedParent = [];
207+
$dataItem = $matchedParams[1][$paramKey];
208+
preg_match_all("/(.+?)\./", $dataItem, $matchedParent);
209+
210+
if (!empty($matchedParent) && !empty($matchedParent[0]))
211+
{
212+
$paramEntityParent = $matchedParent[1][0];
213+
$dataItem = preg_replace('/^'.$matchedParent[0][0].'/', '', $dataItem);
214+
}
215+
204216
foreach ($entityObjects as $entityObject) {
205-
$param = $entityObject->getDataByName(
206-
$matchedParams[1][$paramKey],
207-
EntityDataObject::CEST_UNIQUE_VALUE
208-
);
217+
218+
if ($paramEntityParent === "" || $entityObject->getType() == $paramEntityParent)
219+
{
220+
$param = $entityObject->getDataByName(
221+
$dataItem,
222+
EntityDataObject::CEST_UNIQUE_VALUE
223+
);
224+
}
225+
209226
if (null !== $param) {
210227
$urlOut = str_replace($paramValue, $param, $urlOut);
228+
$param = null;
211229
continue;
212230
}
213231
}

0 commit comments

Comments
 (0)