Skip to content

Commit e809520

Browse files
committed
add check for null values
1 parent 4191e71 commit e809520

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
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 & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,18 +2097,20 @@ private function resolveRuntimeReference($args, $regex, $func)
20972097

20982098
foreach ($args as $key => $arg) {
20992099
$newArgs[$key] = $arg;
2100-
preg_match_all($regex, $arg, $matches);
2101-
if (!empty($matches[0])) {
2102-
foreach ($matches[0] as $matchKey => $fullMatch) {
2103-
$refVariable = $matches[1][$matchKey];
2100+
if($arg !== null) {
2101+
preg_match_all($regex, $arg, $matches);
2102+
if (!empty($matches[0])) {
2103+
foreach ($matches[0] as $matchKey => $fullMatch) {
2104+
$refVariable = $matches[1][$matchKey];
21042105

2105-
$replacement = $this->getReplacement($func, $refVariable);
2106+
$replacement = $this->getReplacement($func, $refVariable);
21062107

2107-
$outputArg = $this->processQuoteBreaks($fullMatch, $newArgs[$key], $replacement);
2108-
$newArgs[$key] = $outputArg;
2108+
$outputArg = $this->processQuoteBreaks($fullMatch, $newArgs[$key], $replacement);
2109+
$newArgs[$key] = $outputArg;
2110+
}
2111+
unset($matches);
2112+
continue;
21092113
}
2110-
unset($matches);
2111-
continue;
21122114
}
21132115
}
21142116

0 commit comments

Comments
 (0)