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()
3232 TestLoggingUtil::getInstance ()->setMockLoggingUtil ();
3333 }
3434
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+
3559 public function testCreateSimpleEntity ()
3660 {
3761 // Test Data and Variables
Original file line number Diff line number Diff line change @@ -97,6 +97,14 @@ public function createEntity(
9797 }
9898
9999 $ 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+
100108 $ persistedObject = new DataPersistenceHandler (
101109 $ retrievedEntity ,
102110 $ retrievedDependentObjects ,
You can’t perform that action at this time.
0 commit comments