Skip to content

Commit 12d1f63

Browse files
committed
MQE-1184: Describe which entity reference fails in generate:tests
- Added information on exception thrown.
1 parent ba061e6 commit 12d1f63

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,10 @@ 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}\" in action \"{$this->getStepKey()}\"",
526+
["input" => $inputString, "stepKey" => $this->getStepKey()]
527+
);
525528
}
526529
$parameterized = $obj->getElement($objField)->isParameterized();
527530
$replacement = $obj->getElement($objField)->getPrioritizedSelector();
@@ -538,7 +541,10 @@ private function findAndReplaceReferences($objectHandler, $inputString)
538541
if (get_class($objectHandler) != DataObjectHandler::class) {
539542
return $this->findAndReplaceReferences(DataObjectHandler::getInstance(), $outputString);
540543
} else {
541-
throw new TestReferenceException("Could not resolve entity reference", ["input" => $inputString]);
544+
throw new TestReferenceException(
545+
"Could not resolve entity reference \"{$inputString}\" in Action \"{$this->getStepKey()}\"",
546+
["input" => $inputString, "stepKey" => $this->getStepKey()]
547+
);
542548
}
543549
}
544550

0 commit comments

Comments
 (0)