Skip to content

Commit b299c31

Browse files
authored
Merge pull request #161 from magento-gl/MQE-3228
MQE-3228: Update MFTF to not pass NULL into non-nullable arguments
2 parents d8fdaaf + 27d5ee6 commit b299c31

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/Magento/FunctionalTestingFramework/Page/Objects/ElementObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct($name, $type, $selector, $locatorFunction, $timeout,
8585
$this->type = $type;
8686
$this->selector = $selector;
8787
$this->locatorFunction = $locatorFunction;
88-
if (strpos($locatorFunction, "Locator::") === false) {
88+
if ($locatorFunction !== null && strpos($locatorFunction, "Locator::") === false) {
8989
$this->locatorFunction = "Locator::" . $locatorFunction;
9090
}
9191
$this->timeout = $timeout;

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,18 +2140,18 @@ private function resolveRuntimeReference($args, $regex, $func)
21402140

21412141
foreach ($args as $key => $arg) {
21422142
$newArgs[$key] = $arg;
2143-
preg_match_all($regex, $arg, $matches);
2144-
if (!empty($matches[0])) {
2145-
foreach ($matches[0] as $matchKey => $fullMatch) {
2146-
$refVariable = $matches[1][$matchKey];
2147-
2148-
$replacement = $this->getReplacement($func, $refVariable);
2149-
2150-
$outputArg = $this->processQuoteBreaks($fullMatch, $newArgs[$key], $replacement);
2151-
$newArgs[$key] = $outputArg;
2143+
if ($arg !== null) {
2144+
preg_match_all($regex, $arg, $matches);
2145+
if (!empty($matches[0])) {
2146+
foreach ($matches[0] as $matchKey => $fullMatch) {
2147+
$refVariable = $matches[1][$matchKey];
2148+
$replacement = $this->getReplacement($func, $refVariable);
2149+
$outputArg = $this->processQuoteBreaks($fullMatch, $newArgs[$key], $replacement);
2150+
$newArgs[$key] = $outputArg;
2151+
}
2152+
unset($matches);
2153+
continue;
21522154
}
2153-
unset($matches);
2154-
continue;
21552155
}
21562156
}
21572157

0 commit comments

Comments
 (0)