File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
dev/tests/unit/Magento/FunctionalTestFramework/Test/Util
src/Magento/FunctionalTestingFramework/Test/Util Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,15 @@ public function testAmbiguousMergeOrderReference()
8989 );
9090 }
9191
92+ /**
93+ * Tests basic action object extraction with an empty stepKey
94+ */
95+ public function testEmptyStepKey ()
96+ {
97+ $ this ->expectExceptionMessage ("StepKeys cannot be empty. Action='sampleAction' " );
98+ $ this ->testActionObjectExtractor ->extractActions ($ this ->createBasicActionObjectArray ("" ));
99+ }
100+
92101 /**
93102 * Utility function to return mock parser output for testing extraction into ActionObjects.
94103 *
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ class ActionObjectExtractor extends BaseObjectExtractor
2727 const ACTION_GROUP_ARG_VALUE = 'value ' ;
2828 const BEFORE_AFTER_ERROR_MSG = "Merge Error - Steps cannot have both before and after attributes. \tStepKey='%s' " ;
2929 const STEP_KEY_BLACKLIST_ERROR_MSG = "StepKeys cannot contain non alphanumeric characters. \tStepKey='%s' " ;
30+ const STEP_KEY_EMPTY_ERROR_MSG = "StepKeys cannot be empty. \tAction='%s' " ;
3031 const DATA_PERSISTENCE_CUSTOM_FIELD = 'field ' ;
3132 const DATA_PERSISTENCE_CUSTOM_FIELD_KEY = 'key ' ;
3233 const ACTION_OBJECT_PERSISTENCE_FIELDS = 'customFields ' ;
@@ -59,6 +60,10 @@ public function extractActions($testActions, $testName = null)
5960 foreach ($ testActions as $ actionName => $ actionData ) {
6061 $ stepKey = $ actionData [self ::TEST_STEP_MERGE_KEY ];
6162
63+ if (empty ($ stepKey )) {
64+ throw new XmlException (sprintf (self ::STEP_KEY_EMPTY_ERROR_MSG , $ actionData ['nodeName ' ]));
65+ }
66+
6267 if (preg_match ('/[^a-zA-Z0-9_]/ ' , $ stepKey )) {
6368 throw new XmlException (sprintf (self ::STEP_KEY_BLACKLIST_ERROR_MSG , $ actionName ));
6469 }
You can’t perform that action at this time.
0 commit comments