Skip to content

Commit 5003492

Browse files
committed
MQE-679: 2 or more params in a url are not properly replaced
MQE-877: Passing Multiple Element References In Selector Parameters Does Not Generate Correctly When Element(s) Are Parameterized
1 parent dd3dd48 commit 5003492

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private function resolveUrlReference($urlIn, $entityObjects)
206206
EntityDataObject::CEST_UNIQUE_VALUE
207207
);
208208
if (null !== $param) {
209-
$urlOut = str_replace($paramValue, $param, $urlIn);
209+
$urlOut = str_replace($paramValue, $param, $urlOut);
210210
continue;
211211
}
212212
}

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ class ActionObject
4040
const ACTION_ATTRIBUTE_URL = 'url';
4141
const ACTION_ATTRIBUTE_SELECTOR = 'selector';
4242
const ACTION_ATTRIBUTE_VARIABLE_REGEX_PARAMETER = '/\(.+\)/';
43-
const ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN = '/{{[\w]+\.?[\w\[\]]+}}/';
44-
const ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN_WITH_PARAMS= '/{{[\w]+\.[\w]+\(.+\)}}/';
43+
const ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN = '/({{[\w]+\.?[\w\[\]]+}})|({{[\w]+\.[\w]+\(.+\)}})/';
4544

4645
/**
4746
* The unique identifier for the action
@@ -444,7 +443,7 @@ private function stripAndReturnParameters($reference)
444443
private function findAndReplaceReferences($objectHandler, $inputString)
445444
{
446445
//look for parameter area, if so use different regex
447-
$regex = $this->resolveRegexPatternForReference($inputString);
446+
$regex = ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN;
448447

449448
preg_match_all($regex, $inputString, $matches);
450449

@@ -514,20 +513,6 @@ private function validateUrlAreaAgainstActionType($obj)
514513
}
515514
}
516515

517-
/**
518-
* Determines whether the given $inputString has (params), and returns the appropriate regex for use in matching.
519-
* @param string $inputString
520-
* @return string
521-
*/
522-
private function resolveRegexPatternForReference($inputString)
523-
{
524-
if (preg_match(ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN_WITH_PARAMS, $inputString) === 1) {
525-
return ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN_WITH_PARAMS;
526-
} else {
527-
return ActionObject::ACTION_ATTRIBUTE_VARIABLE_REGEX_PATTERN;
528-
}
529-
}
530-
531516
/**
532517
* Gets the object's dataByName with given $match, differentiating behavior between <array> and <data> nodes.
533518
* @param string $obj

0 commit comments

Comments
 (0)