Skip to content

Commit dc102e7

Browse files
authored
MQE-1184: Describe which entity reference fails in generate:tests
- Added information on exception thrown.
1 parent 5d6d254 commit dc102e7

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,11 @@ private function findAndReplaceReferences($objectHandler, $inputString)
521521
} elseif (get_class($obj) == SectionObject::class) {
522522
list(,$objField) = $this->stripAndSplitReference($match);
523523
if ($obj->getElement($objField) == null) {
524-
throw new TestReferenceException("Could not resolve entity reference", ["input" => $inputString]);
524+
throw new TestReferenceException(
525+
"Could not resolve entity reference \"{$inputString}\" "
526+
. "in Action with stepKey \"{$this->getStepKey()}\"",
527+
["input" => $inputString, "stepKey" => $this->getStepKey()]
528+
);
525529
}
526530
$parameterized = $obj->getElement($objField)->isParameterized();
527531
$replacement = $obj->getElement($objField)->getPrioritizedSelector();
@@ -538,7 +542,11 @@ private function findAndReplaceReferences($objectHandler, $inputString)
538542
if (get_class($objectHandler) != DataObjectHandler::class) {
539543
return $this->findAndReplaceReferences(DataObjectHandler::getInstance(), $outputString);
540544
} else {
541-
throw new TestReferenceException("Could not resolve entity reference", ["input" => $inputString]);
545+
throw new TestReferenceException(
546+
"Could not resolve entity reference \"{$inputString}\" "
547+
. "in Action with stepKey \"{$this->getStepKey()}\"",
548+
["input" => $inputString, "stepKey" => $this->getStepKey()]
549+
);
542550
}
543551
}
544552

0 commit comments

Comments
 (0)