File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
dev/tests/unit/Magento/FunctionalTestFramework/DataGenerator/Handlers
src/Magento/FunctionalTestingFramework/DataGenerator/Handlers Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,30 @@ public function setUp()
32
32
TestLoggingUtil::getInstance ()->setMockLoggingUtil ();
33
33
}
34
34
35
+ public function testCreateEntityWithNonExistingName ()
36
+ {
37
+ // Test Data and Variables
38
+ $ entityName = "InvalidEntity " ;
39
+ $ entityStepKey = "StepKey " ;
40
+ $ scope = PersistedObjectHandler::TEST_SCOPE ;
41
+
42
+ $ exceptionMessage = "Entity \"" . $ entityName . "\" does not exist. " .
43
+ "\nException occurred executing action at StepKey \"" . $ entityStepKey . "\"" ;
44
+
45
+ $ this ->expectException (TestReferenceException::class);
46
+
47
+ $ this ->expectExceptionMessage ($ exceptionMessage );
48
+
49
+ $ handler = PersistedObjectHandler::getInstance ();
50
+
51
+ // Call method
52
+ $ handler ->createEntity (
53
+ $ entityStepKey ,
54
+ $ scope ,
55
+ $ entityName
56
+ );
57
+ }
58
+
35
59
public function testCreateSimpleEntity ()
36
60
{
37
61
// Test Data and Variables
Original file line number Diff line number Diff line change @@ -97,6 +97,14 @@ public function createEntity(
97
97
}
98
98
99
99
$ retrievedEntity = DataObjectHandler::getInstance ()->getObject ($ entity );
100
+
101
+ if ($ retrievedEntity === null ) {
102
+ throw new TestReferenceException (
103
+ "Entity \"" . $ entity . "\" does not exist. " .
104
+ "\nException occurred executing action at StepKey \"" . $ key . "\""
105
+ );
106
+ }
107
+
100
108
$ persistedObject = new DataPersistenceHandler (
101
109
$ retrievedEntity ,
102
110
$ retrievedDependentObjects ,
You can’t perform that action at this time.
0 commit comments