Skip to content

Commit af0a499

Browse files
committed
MQE-1513: createData throws a useless error message during runtime when the entity does not exist
reverted changes Added unit test
1 parent a415f05 commit af0a499

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers/PersistedObjectHandlerTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@ public function setUp()
3232
TestLoggingUtil::getInstance()->setMockLoggingUtil();
3333
}
3434

35+
public function testCreateInvalidEntity()
36+
{
37+
// Test Data and Variables
38+
39+
$entityName = "InvalidEntity";
40+
$entityStepKey = "StepKey";
41+
$scope = PersistedObjectHandler::TEST_SCOPE;
42+
43+
$exceptionMessage = "Entity \"" . $entityName . "\" does not exist." .
44+
"\nException occurred parsing action at StepKey \"" . $entityStepKey . "\"";
45+
46+
$this->expectException(TestReferenceException::class);
47+
48+
$this->expectExceptionMessage($exceptionMessage);
49+
50+
$handler = PersistedObjectHandler::getInstance();
51+
52+
// Call method
53+
$handler->createEntity(
54+
$entityStepKey,
55+
$scope,
56+
$entityName
57+
);
58+
}
59+
3560
public function testCreateSimpleEntity()
3661
{
3762
// Test Data and Variables

0 commit comments

Comments
 (0)